Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Get certified in Microsoft Fabric—for free! For a limited time, get a free DP-600 exam voucher to use by the end of 2024. Register now

Reply
Anonymous
Not applicable

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.

1 ACCEPTED SOLUTION
vik0810
Resolver V
Resolver V

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.

View solution in original post

5 REPLIES 5
Mariusz
Community Champion
Community 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

 

vik0810
Resolver V
Resolver V

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.

Worked Beautifully! Thank You.

Your formula:

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

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

cabc_xlorla_0-1619201329210.png

 

 

Anonymous
Not applicable

@vik0810 

 

Yeah, Thanks !!

I just accomplished this..


Helpful resources

Announcements
November Carousel

Fabric Community Update - November 2024

Find out what's new and trending in the Fabric Community.

Live Sessions with Fabric DB

Be one of the first to start using Fabric Databases

Starting December 3, join live sessions with database experts and the Fabric product team to learn just how easy it is to get started.

Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount! Early Bird pricing ends December 9th.

Nov PBI Update Carousel

Power BI Monthly Update - November 2024

Check out the November 2024 Power BI update to learn about new features.