Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
6 years ago
Solved

Alternative of SELECTEDVALUE DAX function

Guys,

 

We have a Employee Name Slicer in Power BI and were showing some counts based on slicer selection using SELECTEDVALUE function. We are migrating our entire steup to Prod environment on SSAS 2016 where SELECTEDVALUE is not compatible.

 

Also we tried with HASONEVALUE(), but I guess this can be used with only numeric or date type values. As discussed above we are having string type values as Employee Names.

 

Please suggest us an alternative that can be used in this place with String type values.

  • HI,

     

    SELECTEDVALUE is internally translated into following

     

    IF ( HASONEVALUE ( Table[column] ), VALUES ( Table[column] ) )

     So just use the IF expansion. And it does work with string types also.

5 Replies

  • HI,

     

    SELECTEDVALUE is internally translated into following

     

    IF ( HASONEVALUE ( Table[column] ), VALUES ( Table[column] ) )

     So just use the IF expansion. And it does work with string types also.

    • Anonymous's avatar
      Anonymous
      Not applicable

      vik0810 

       

      Yeah, Thanks !!

      I just accomplished this..


    • cabc_xlorla's avatar
      cabc_xlorla
      Icon for Advocate IV rankAdvocate IV

      Your formula:

      IF ( HASONEVALUE ( Table[column] ), VALUES ( Table[column] ) )

      is a personal-game-changer for me.  Thanks!
      Please feel free to connect with me.

       

       

  • Mariusz's avatar
    Mariusz
    Icon for Community Champion rankCommunity Champion

    Hi Anonymous 

     

    Try MAX()

     

     

    Best Regards,
    Mariusz

    If this post helps, then please consider Accepting it as the solution.

    Please feel free to connect with me.
    Mariusz Repczynski