Join us at FabCon Atlanta from March 16 - 20, 2026, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.
Register now!Join the Fabric FabCon Global Hackathon—running virtually through Nov 3. Open to all skill levels. $10,000 in prizes! Register now.
Dear experts,
Based on the table,
I have two condition need to calculate which is
i.)Only want get the data (Profit) which Origin/Dest is under MYKUL,MYPEN,CNSHA,SGSIN. Other from this, data(Profit) will ignore.
ii.)If Origin=Dest. Data will be ignore too (Example like CNSHA=CNSHA).
With the help, i able get DAX.
=Calculate(sum(table[profit]), filter(Table, table[origin]<>table[destination] && table[origin] in {"MYKUL","MYPEN","CNSHA","SGSIN"}.
But if I want to use LIKE (IN SQL) statement, for example calculate origin column which the start with "MY.." , "CN..".
How the DAX function will be like.
Hope you will have a great day!
Best thanks.
Solved! Go to Solution.
HI @NickProp28 ,
You can have a look at this
https://www.sqlbi.com/articles/from-sql-to-dax-string-comparison/
Regards,
Harsh Nathani
Hi @NickProp28 ,
I Tried replicating this with some dummy data. Work well for me.
Count =
CALCULATE (
SUM ( Financial[Job Profit] ),
FILTER (
Financial,
Financial[Origin] <> Financial[Dest]
&& LEFT (
Financial[Origin],
2
)
IN {
"SG",
"MY"
}
&& LEFT (
Financial[Dest],
2
)
IN {
"SG",
"MY"
}
)
)
Just to troubleshoot ,try to Trim your Origin and Destination Columns in Power Query to removing leading spaces if any.
Regards,
Harsh Nathani
Hi all,
@amitchandak @mahoneypat @harshnathani ,
I try it and come out with this DAX.
But the calculation is wrong. Can you guys take a look on my DAX.
Count = CALCULATE(SUM(Financial[Job Profit]),FILTER(Financial,Financial[Origin]<>Financial[Dest] && LEFT(Financial[Origin],2) IN {"SG","MY"} && LEFT(Financial[Dest],2) IN {"SG","MY"}))
This is from https://www.sqlbi.com/articles/from-sql-to-dax-string-comparison/
Hope you guys have a great day.
Best thanks.
Hi @NickProp28 ,
I Tried replicating this with some dummy data. Work well for me.
Count =
CALCULATE (
SUM ( Financial[Job Profit] ),
FILTER (
Financial,
Financial[Origin] <> Financial[Dest]
&& LEFT (
Financial[Origin],
2
)
IN {
"SG",
"MY"
}
&& LEFT (
Financial[Dest],
2
)
IN {
"SG",
"MY"
}
)
)
Just to troubleshoot ,try to Trim your Origin and Destination Columns in Power Query to removing leading spaces if any.
Regards,
Harsh Nathani
One simple way to do this would be to add a column in query or DAX that shows the first two letters in that column. Then you can use your same approach/measure with that new column "... in {"MY", "CN"} ..."
If this works for you, please mark it as the solution. Kudos are appreciated too. Please let me know if not.
Regards,
Pat
To learn more about Power BI, follow me on Twitter or subscribe on YouTube.
HI @NickProp28 ,
You can have a look at this
https://www.sqlbi.com/articles/from-sql-to-dax-string-comparison/
Regards,
Harsh Nathani
Join the Fabric FabCon Global Hackathon—running virtually through Nov 3. Open to all skill levels. $10,000 in prizes!
Check out the September 2025 Power BI update to learn about new features.