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

Calling all Data Engineers! Fabric Data Engineer (Exam DP-700) live sessions are back! Starting October 16th. Sign up.

Reply
Anonymous
Not applicable

need help on how to implement case statement in DAX

Hi All

           Need help on how to write DAX for the below scenario

AnithaM_0-1698672710275.png

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

 

 

4 REPLIES 4

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

miTutorials
Super User
Super User

Anonymous
Not applicable

Hi,

     could you please let me know the dax logic how to write it.

Regards,

Anita

Helpful resources

Announcements
FabCon Global Hackathon Carousel

FabCon Global Hackathon

Join the Fabric FabCon Global Hackathon—running virtually through Nov 3. Open to all skill levels. $10,000 in prizes!

September Power BI Update Carousel

Power BI Monthly Update - September 2025

Check out the September 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
Top Kudoed Authors