使用DAX与来自切片器的SELECTEDVALUE不正常工作。

huangapple go评论63阅读模式
英文:

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.

huangapple
  • 本文由 发表于 2023年6月13日 10:18:45
  • 转载请务必保留本文链接:https://go.coder-hub.com/76461336.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定