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

Get Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Learn more

Reply
Anonymous
Not applicable

IF or SWITCH statement depending on the selected value of another column

Hi,

 

I need a measure that will evaluate a column named "Company" and return a specific currency in the "Currency" column based on the "Company" selection. So in my "Company" column, I have Company A, Company B, Company C, and Company D. In my "Currency" column, I has either BRL or USD. Companies A and B are Brazilian companies, and I have figures for these companies in both BRL and USD currencies. Companies C and D are US companies, so figures for them are only in USD. 

 

I have a clustered column chart showing revenue for each company while "Company" is placed in a slicer. When one of the Brazilian companies (Company A and Company B) is selected, I want figures to be displayed in BRL currency. If one of the non-Brazilian companies (Company C and Company D) is selected, I want figures to be displayed in USD currency. I intend to add this measure as a filter & it work properly.

 

I have tried the following two measures and neither is functioning, and bother return either TRUE or FALSE rather than the desired currency being selected.

 

Currency Fix =
IF(SELECTEDVALUE(Append2[Company])="Company A", SELECTEDVALUE(Append2[Currency])= "BRL", SELECTEDVALUE(Append2[Currency])="USD") &
IF(SELECTEDVALUE(Append2[Company])="Company B", SELECTEDVALUE(Append2[Currency])= "BRL", SELECTEDVALUE(Append2[Currency])="USD")
*Note: I have tried a variation of this IF statement by doing a nested IF statement. Sames incorrect results were given. 
 
Currency Fix =
SWITCH( TRUE(),
SELECTEDVALUE(Append2[Company]) = "Company A", SELECTEDVALUE(Append2[Currency]) ="BRL",
SELECTEDVALUE(Append2[Company]) = "Company B", SELECTEDVALUE(Append2[Currency]) ="BRL")
1 ACCEPTED SOLUTION
v-jingzhang
Community Support
Community Support

Hi @Anonymous 

 

SELECTEDVALUE(Append2[Currency]) ="BRL" is a logical condition statement, so it will always return a logical result True/False.

 

In your scenario, if your table structure is like below ("BRL" and "USD" are both in the Currency column), you could create a measure to calculate the value you need to populate the column chart. For example,

053104.jpg

Amount measure = 
IF (
    SELECTEDVALUE ( 'Table (3)'[Company] ) IN { "Company A", "Company B" },
    CALCULATE ( SUM ( 'Table (3)'[Amount] ), 'Table (3)'[Currency] = "BRL" ),
    SUM ( 'Table (3)'[Amount] )
)

053105.jpg

 

You could modify the measure per your need.

 

Regards,
Community Support Team _ Jing
If this post helps, please Accept it as the solution to help other members find it.

View solution in original post

3 REPLIES 3
v-jingzhang
Community Support
Community Support

Hi @Anonymous 

 

SELECTEDVALUE(Append2[Currency]) ="BRL" is a logical condition statement, so it will always return a logical result True/False.

 

In your scenario, if your table structure is like below ("BRL" and "USD" are both in the Currency column), you could create a measure to calculate the value you need to populate the column chart. For example,

053104.jpg

Amount measure = 
IF (
    SELECTEDVALUE ( 'Table (3)'[Company] ) IN { "Company A", "Company B" },
    CALCULATE ( SUM ( 'Table (3)'[Amount] ), 'Table (3)'[Currency] = "BRL" ),
    SUM ( 'Table (3)'[Amount] )
)

053105.jpg

 

You could modify the measure per your need.

 

Regards,
Community Support Team _ Jing
If this post helps, please Accept it as the solution to help other members find it.

Anonymous
Not applicable

This worked perfectly! Thank you so much!!

lbendlin
Super User
Super User

Your question is ambiguous.  Do you need to return the currency string, or do you need to return a monetary value (possibly even with FX applied)?

Helpful resources

Announcements
Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

October Power BI Update Carousel

Power BI Monthly Update - October 2025

Check out the October 2025 Power BI update to learn about new features.

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.

Top Solution Authors