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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
ecoast16
Frequent Visitor

If SELECTEDVALUE returns blank, use default value - can not get AlternateResult to work

Hi PowerBI community!

 

I am been working on this problem for some time and can not seem to figure it out. Here is the scenario:

  • I have a matrix with total amounts by currencies on it, and I want to calculate a new value based on a target percent.
  • My table with the target percents will either have the currency listed, or if not specified will have a 'default' target percent.
  •  For the matrix I want to show the target percent if the currency is listed or the 'default' target if not.

This is what I get so far, essentialy I want to move the target percent from the blank row to the GBP row

ecoast16_0-1614117972176.png

I have tried SELECTEDVALUE, using the AlternateResult, but will not show the 'default value':

ecoast16_1-1614118036970.png

Thanks four your time, and have included a sample file if helpful. Thank you!!!

 

 

1 ACCEPTED SOLUTION
AlexisOlson
Super User
Super User

I'd try defining the default value as a variable. It's easier to debug that way.

Target (SelectedValue) =
VAR Default =
    LOOKUPVALUE ( Target[Target], Target[Currency], "Default" )
RETURN
    IF ( NOT ISEMPTY ( Amount ), SELECTEDVALUE ( Target[Target], Default ) )

AlexisOlson_0-1614119726107.png

 

View solution in original post

2 REPLIES 2
AlexisOlson
Super User
Super User

I'd try defining the default value as a variable. It's easier to debug that way.

Target (SelectedValue) =
VAR Default =
    LOOKUPVALUE ( Target[Target], Target[Currency], "Default" )
RETURN
    IF ( NOT ISEMPTY ( Amount ), SELECTEDVALUE ( Target[Target], Default ) )

AlexisOlson_0-1614119726107.png

 

@AlexisOlson Awesome! Thanks so much for taking a look, and figuring it out. much appreciated.

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

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

April Fabric Community Update

Fabric Community Update - April 2024

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