Advance your Data & AI career with 50 days of live learning, dataviz contests, hands-on challenges, study groups & certifications and more!
Get registeredGet Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Request now
Hi,
May I know the Difference b/w a Normal Switch & switch with TURE()? in DAX
Which one is the optimistic?
Thanks,
Srinivas.
Solved! Go to Solution.
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 ,
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
)
Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!
Check out the October 2025 Power BI update to learn about new features.
| User | Count |
|---|---|
| 8 | |
| 6 | |
| 5 | |
| 5 | |
| 4 |
| User | Count |
|---|---|
| 25 | |
| 16 | |
| 8 | |
| 7 | |
| 7 |