英文:
Using DAX with a SELECTEDVALUE From Slicer Not Working correctly
问题
I have a slicer which selects a username then using the Selected Value I want to compare this against a column in a table to set a Yes or No if its present within the Column. This is not working and always returns No, Although I know the SELECTEDVALUE is correct and has the value I need, if I try and interogate the value it always returns a blank
This is driving my crazy for something so simple, any help would be appreciated
UserFound =
IF(vwRptAlertRoles[General Manager] = SELECTEDVALUE(vwRptUserProfile[UserName]),"Yes","No")
Thanks
David
英文:
I have a slicer which selects a username then using the Selected Value I want to compare this against a column in a table to set a Yes or No if its present within the Column. This is not working and always returns No, Although I know the SELECTEDVALUE is correct and has the value I need, if I try and interogate the value it always returns a blank
This is driving my crazy for something so simple, any help would be appreciated
UserFound =
IF(vwRptAlertRoles[General Manager] = SELECTEDVALUE(vwRptUserProfile[UserName]),"Yes","No")
Thanks
David
答案1
得分: 0
问题是测量部分返回多个值,对于vwRptAlertRoles[General Manager]项目。
您需要的是,而不是检查=,要检查IN:
UserFound = IF(SELECTEDVALUE(vwRptUserProfile[UserName]) IN VALUES(vwRptUserProfile[UserName]), "是", "否")
VALUES返回该列中可以在IN部分进行比较的项目的不同列表。
英文:
The issue is that part of the measure is returning multiple values for the vwRptAlertRoles[General Manager] item.
What you need to to is rather than check for =, check for IN:
UserFound = IF(SELECTEDVALUE(vwRptUserProfile[UserName) IN VALUES(vwRptUserProfile[UserName]), "Yes", "No")
VALUES returns a distinct list of item in that column that it can compare in the IN part.
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论