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

Earn a 50% discount on the DP-600 certification exam by completing the Fabric 30 Days to Learn It 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
LearnSurvey

Fabric certifications survey

Certification feedback opportunity for the community.

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

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

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.