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
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"}))

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"}))

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

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.