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

View all the Fabric Data Days sessions on demand. View schedule

Reply
NickProp28
Post Partisan
Post Partisan

Need Help with DAX Statement

Hi experts, 

 

Good day, 

 

NickProp28_0-1592904380639.png

I new to DAX, hoping someone can help me on conditional code.

Based on the table,

The first condition is, I only want get the data (Profit) which Origin/Dest is under MYKUL,MYPEN,CNSHA,SGSIN. Other from this, data(Profit) will ignore.

Second condition , if Original=Dest. Data will be ignore too (Example like CNSHA=CNSHA).

 

Hope you will have a great day!
Best thanks.

 

 

1 ACCEPTED SOLUTION
amitchandak
Super User
Super User

@NickProp28 , something like this

calculate(sum(table[profit]), filter(Table, table[origin]<>table[destination] && table[origin] in {"MYKUL","MYPEN","CNSHA","SGSIN"}
&& table[destination] in {"MYKUL","MYPEN","CNSHA","SGSIN"}))

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

View solution in original post

3 REPLIES 3
amitchandak
Super User
Super User

@NickProp28 , something like this

calculate(sum(table[profit]), filter(Table, table[origin]<>table[destination] && table[origin] in {"MYKUL","MYPEN","CNSHA","SGSIN"}
&& table[destination] in {"MYKUL","MYPEN","CNSHA","SGSIN"}))

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

Dear @amitchandak,

 

Thanks for your quick response. I have one more question, if i wound like to use LIKE statement. (LIKE 'SG%','MY%' in sql)

In this case, how the code would like be? 

 

Best regards

@NickProp28 ,

https://docs.microsoft.com/en-us/dax/containsstring-function-dax

https://docs.microsoft.com/en-us/dax/search-function-dax

https://docs.microsoft.com/en-us/dax/find-function-dax

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

Helpful resources

Announcements
November Power BI Update Carousel

Power BI Monthly Update - November 2025

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

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!

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