Advance your Data & AI career with 50 days of live learning, dataviz contests, hands-on challenges, study groups & certifications and more!
Get registeredGet Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Request now
Hi All
Need help on how to write DAX for the below scenario
i need to create a dax calcultions for calculated columns for below
1.case when Acc Number ='54112' then Amount
2.case whenAcc Number in ('54112','56019','44291','442901') then Amount.
Regards,
Anita
Good Morning, Anita,
You should be able to do this with a Switch(True()) function.
For a calulated column, your code should look something like this. :
Calculated Column =
SWITCH(
TRUE(),
TableName[Acc Number] = "54112", TableName[Amount],
TableName[Acc Number] in {"54112", "56019", "44291", "442901"}, TableName[Amount],
Blank())The syntax for a measure changes some, so be aware of that. I used TableName as a placeholder for whatever your table is called in your model.
I wasn't sure what your return value was for anything outside the parameters so I put a blank() to make it easy.
Hopefully this helps!
Thanks,
JTB
You can use a Switch statement to achieve this.
When to use Switch Statement instead of IF Statement in PowerBI | MiTutorials - YouTube
Hi,
could you please let me know the dax logic how to write it.
Regards,
Anita
Please see the video below.
When to use Switch Statement instead of IF Statement in PowerBI | MiTutorials - YouTube
Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!
Check out the October 2025 Power BI update to learn about new features.