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

Be one of the first to start using Fabric Databases. View on-demand sessions with database experts and the Microsoft product team to learn just how easy it is to get started. Watch now

Reply
justine0812
Frequent Visitor

SWITCH and IF statements

Hi,

 

I am trying to create a DAX measure that follows a slicer whether the selected currency is EUR or GBP. I have the following DAX measure but it doesn't seem to work. I'm just a bit confused how SWITCH works, because as per my logic it should work, but it doesn't seem to.

 

justine0812_0-1680097493669.png

 

I have created here a table for the currency slicer (GBP or EUR) and created a measure for "Selected Currency" that I have to use in doing the SWITCH function. The idea is "IF GBP is selected, use the following filters and then sum up a column in the table. 

 

But it doesn't seem to work. Would anyone be able to help me?

 

Thanks!

 

1 REPLY 1
lbendlin
Super User
Super User

Use DAXFormatter.com to make sense of your rather complex code and then refactor it .  Note that you can have nested SWITCH statements.  Also note that SWITCH only improves readability. It is technically the same as nested IFs  (sometimes also called "syntax sugar").

Helpful resources

Announcements
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!

Dec Fabric Community Survey

We want your feedback!

Your insights matter. That’s why we created a quick survey to learn about your experience finding answers to technical questions.

ArunFabCon

Microsoft Fabric Community Conference 2025

Arun Ulag shares exciting details about the Microsoft Fabric Conference 2025, which will be held in Las Vegas, NV.

December 2024

A Year in Review - December 2024

Find out what content was popular in the Fabric community during 2024.