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.
Hi,
May I know the Difference b/w a Normal Switch & switch with TURE()? in DAX
Which one is the optimistic?
Thanks,
Srinivas.
Hi @Koritala ,
Could you let us know if your issue has been resolved or if you are still experiencing difficulties? Your feedback is valuable to the community and can help others facing similar problems.
Hi @Koritala ,
Thank you for reaching out to the Fabric Community. @GeraldGEmerick provided a clear explanation. To add, the regular SWITCH() function is ideal when comparing a single value to several options, much like the CASE statement in SQL. On the other hand, SWITCH(TRUE()) offers more flexibility for checking multiple conditions and can help simplify logic compared to using many nested IF statements.
In terms of performance, there isn’t a significant difference between the two; the choice mainly depends on the complexity of your conditions and which method is easier to read and maintain.
Thanks for quick response @GeraldGEmerick .
Regards,
Yugandhar
@Koritala The "normal" SWITCH statement takes a value as the first parameter and then each pair of statements after that simply checks if that value equals the first value in the pair of statements and if so returns the second value in the pair of statements. For example:
SWITCH(
MAX( 'Table'[Color] ), //first parameter this is the value to check
"Red", 1, // if the first parameter equals "Red" then return 1
"Blue", 2 // if the first parameter equals "Blue" then return 2
3 // otherwise, return 3 if the color is neither red or blue
)
SWITCH TRUE is a more flexible version where each pair of statements after the first parameter (TRUE) you can have a logical test which, if it evaluates to true, returns the corresponding value. For example:
SWITCH(
TRUE(),
MAX( 'Table'[Color] ) = "Red" && SUM( 'Table'[Value] ) < 100, 1,
MAX( 'Table'[Color] ) = "Red" && SUM( 'Table'[Value] ) < 200, 2,
3
)