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!To celebrate FabCon Vienna, we are offering 50% off select exams. Ends October 3rd. Request your discount now.
Hi all
I am a simple expression to write, yet I am having a lot of trouble to translate in DAX, I must be doing someting consistently wrong. I seek your valuable help. Many thanks.
If [Region] in ( “NewYork”, “Louisana”)
{
If [salesAmount] >[Target]
{
[value] = 0
}
}
else /* Different Region */
{
If [salesAmount] < [Target] /* Note check is different < */
{
[value]= 0
}
}
Solved! Go to Solution.
Hello @JaweedL ,
You can use Switch Function to simplify your If code in DAX, please try the below code..
Result =
SWITCH (
TRUE(),
AND ( OR ( [Region] = "NewYork", [Region] = "Louisana" ), [salesAmount] > [Target] ), 0,
AND ( NOT ( OR ( [Region] = "NewYork", [Region] = "Louisana" ) ), [salesAmount] < [Target] ), 0,[value])
If you find this helpful , please mark it as solution and Your Kudos/Likes are much appreciated!
Thank You
Dharmendar S
what does [value]=0 mean?
maybe you can try something like below
If ( [Region] in { “NewYork”, “Louisana”} && salesAmount] >[Target] , XXXX , if ( NOT ([Region] in { “NewYork”, “Louisana”} ) && [salesAmount] < [Target], XXXX))
Proud to be a Super User!
Thank you Dharmendar. It works, but I have difficulties to understand te code.
what does [value]=0 mean?
maybe you can try something like below
If ( [Region] in { “NewYork”, “Louisana”} && salesAmount] >[Target] , XXXX , if ( NOT ([Region] in { “NewYork”, “Louisana”} ) && [salesAmount] < [Target], XXXX))
Proud to be a Super User!
Hi ryan_mayu
Thank you. Works perfectly. Value was a meaure that I used for conditiinal formatting
Hello @JaweedL ,
You can use Switch Function to simplify your If code in DAX, please try the below code..
Result =
SWITCH (
TRUE(),
AND ( OR ( [Region] = "NewYork", [Region] = "Louisana" ), [salesAmount] > [Target] ), 0,
AND ( NOT ( OR ( [Region] = "NewYork", [Region] = "Louisana" ) ), [salesAmount] < [Target] ), 0,[value])
If you find this helpful , please mark it as solution and Your Kudos/Likes are much appreciated!
Thank You
Dharmendar S