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!Calling all Data Engineers! Fabric Data Engineer (Exam DP-700) live sessions are back! Starting October 16th. Sign up.
I have a formula that I used in Datastudio but I cannot figure out how to convert it to Dax:
Solved! Go to Solution.
Hi @anna_zuckers ,
Here are the steps you can follow:
Create calculated column.
Formula #1:
Formula #1=
IF(
[Word Count] >4 ,"Long tail","Short tail")
Formula #2:
Formula #2 =
SWITCH(
TRUE(),
[Avg position] >=0&&[Avg position]<=3,"Hyper traffic (1-3)",
[Avg position] >3&&[Avg position]<=10,"Traffic (4-10)",
[Avg position] >10&&[Avg position]<=20,"Striking Distance (11-20)",
[Avg position]>20,"Did not Rank",
"No Rank")
Formula #3:
Formula #3 =
SWITCH(
TRUE(),
CONTAINSSTRING('Table3'[query],".*omega.*")=TRUE(),
SUBSTITUTE(
[query],".*omega.*","Omega"),
CONTAINSSTRING('Table3'[query],".*hublot.*")=TRUE(),
SUBSTITUTE(
[query],".*hublot.*","Hublo"),
CONTAINSSTRING('Table3'[query],".*invicta.*")=TRUE(),
SUBSTITUTE(
[query],".*invicta.*","Invicta"),
"Others")
Best Regards,
Liu Yang
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly
Hi @anna_zuckers ,
Here are the steps you can follow:
Create calculated column.
Formula #1:
Formula #1=
IF(
[Word Count] >4 ,"Long tail","Short tail")
Formula #2:
Formula #2 =
SWITCH(
TRUE(),
[Avg position] >=0&&[Avg position]<=3,"Hyper traffic (1-3)",
[Avg position] >3&&[Avg position]<=10,"Traffic (4-10)",
[Avg position] >10&&[Avg position]<=20,"Striking Distance (11-20)",
[Avg position]>20,"Did not Rank",
"No Rank")
Formula #3:
Formula #3 =
SWITCH(
TRUE(),
CONTAINSSTRING('Table3'[query],".*omega.*")=TRUE(),
SUBSTITUTE(
[query],".*omega.*","Omega"),
CONTAINSSTRING('Table3'[query],".*hublot.*")=TRUE(),
SUBSTITUTE(
[query],".*hublot.*","Hublo"),
CONTAINSSTRING('Table3'[query],".*invicta.*")=TRUE(),
SUBSTITUTE(
[query],".*invicta.*","Invicta"),
"Others")
Best Regards,
Liu Yang
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly
Hi @anna_zuckers ,
Please consider using a SWITCH statement to mimic this behavior in DAX
https://learn.microsoft.com/en-us/dax/switch-function-dax
https://p3adaptive.com/2015/03/the-diabolical-genius-of-switch-true/
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.