Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Calling all Data Engineers! Fabric Data Engineer (Exam DP-700) live sessions are back! Starting October 16th. Sign up.

Reply
eugenm
Helper II
Helper II

This switch is killing me... Why isn't it displayed properly within a slicer??

Hi,

I am losing my mind trying to figure out what's happening with this switch() statement.
If I am switching the order of each condition/ line, I get different values, but never the proper one - i.e. the entire list.

COHORT =
SWITCH(
    TRUE(),
    MAIN[NodeOrSMT] <> "", "Node SMT Views",
    MAIN[PON] <> "", "PON Views",
    MAIN[Name]= "/api/network-service/diag/cablemodem/all/flux", "TRuns",
    MAIN[Name]= "/api/topology-service/node", "Topo Views",
    "Anything"
)
 
I really hope that the answer is the PBI is buggy when it comes to this....
If there is any issue, what workaround do I have?
Thanks in advance.
1 ACCEPTED SOLUTION
Kaviraj11
Super User
Super User

Overlooking the order of conditions in the SWITCH statement can lead to unexpected results, as the SWITCH function evaluates the conditions in the order they are defined and uses the first matching condition.

 

Ensure that each case appears in the correct sequence, just like you would do with nested IF statements.




Did I answer your question? Mark my post as a solution!

Proud to be a Super User!





View solution in original post

2 REPLIES 2
eugenm
Helper II
Helper II

Yeah, I realized that. I'm working in the fix.

There are also overlaps. It's a pretty complex data set. 

I'm good. Thank you.

Kaviraj11
Super User
Super User

Overlooking the order of conditions in the SWITCH statement can lead to unexpected results, as the SWITCH function evaluates the conditions in the order they are defined and uses the first matching condition.

 

Ensure that each case appears in the correct sequence, just like you would do with nested IF statements.




Did I answer your question? Mark my post as a solution!

Proud to be a Super User!





Helpful resources

Announcements
FabCon Global Hackathon Carousel

FabCon Global Hackathon

Join the Fabric FabCon Global Hackathon—running virtually through Nov 3. Open to all skill levels. $10,000 in prizes!

September Power BI Update Carousel

Power BI Monthly Update - September 2025

Check out the September 2025 Power BI update to learn about new features.

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.

Top Solution Authors
Top Kudoed Authors