Search code examples
powerbidaxselectedvalue

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


Solution

  • 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.