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
Fraukje
Advocate I
Advocate I

Calculated column IF always returns FALSE

I have the following calculated column, and for some reason it will always return to the FALSE expression (i.e. it always uses the RateToDollar):

 

TransactionAmountConverted = CALCULATE(VALUES(Transactions[TransactionAmount]) * (IF([CurrencyFilter] = "EUR", VALUES('Currency'[RateToEuro]), VALUES('Currency'[RateToDollar]))))

 The CurrencyFilter is a calculated measure that gets a report level filter value:

CurrencyFilter = IF(LASTNONBLANK('CurrencyFormat'[Name], 1) = "USD", "USD", "EUR")

I have tested the CurrencyFilter value and it is a 'text' value that indeed is set to "USD" or "EUR" depending on the report filter. Now I really do not understand why the IF statement in the calculated column always goes to the FALSE part...

 

Anyone has any ideas? Any help is much appreciated!

5 REPLIES 5
Greg_Deckler
Super User
Super User

Hmm, that's probably a difficult one to troubleshoot, it is most like some kind of context issue.


@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
The Definitive Guide to Power Query (M)

DAX is easy, CALCULATE makes DAX hard...

Any ideas how to troubleshoot it?

Would need some sample/example data or for you to share a link to your PBIX file. Context issues are tricky.


@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
The Definitive Guide to Power Query (M)

DAX is easy, CALCULATE makes DAX hard...

Part of my data modelPart of my data modelSample dataSample data

The original transaction amounts can be in any currency available in the Currency table. Based on the user's choice of report filter (currently either USD or EUR), the Transaction Amount should display the transaction's converted amount. So for example, if the user selects 'EUR' in the report filter, the Transaction Amount column should display all original transaction amounts converted to euros. Similarly, if the user would select dollar, for dollars.

 

Oh, and the CurrencyFormat was created for the sole reason to act as a report filter.

Could it be that a calculated column cannot handle dynamicly set values from a report filter? Would you know anything about this?

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.

Top Solution Authors