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

Grow your Fabric skills and prepare for the DP-600 certification exam by completing the latest Microsoft Fabric challenge.

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
Responsive Resident
Responsive Resident

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.

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
Responsive Resident
Responsive Resident

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.

Helpful resources

Announcements
RTI Forums Carousel3

New forum boards available in Real-Time Intelligence.

Ask questions in Eventhouse and KQL, Eventstream, and Reflex.

MayPowerBICarousel

Power BI Monthly Update - May 2024

Check out the May 2024 Power BI update to learn about new features.