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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
manuelfigueira
Helper II
Helper II

SWITCH Condition not working for multiples conditions!

Hello Everyone!

 

I'm trying to apply a condition using SWITCH(TRUE() and the last condition is not working at all. When the item age is >181 still is showing HOLD rather then RELEASE and I can't get throug to make the condition show me RELEASE for those > 181, is there something I'm missing on this?

 

Many thanks!!

Manuel

 

Measure = SWITCH(TRUE(),
'Table1'[Condition] = "Ace", "Fly",
RELATED('Pivot'[Status]) = "Unmatched Standard" && 'Table2'[Age] < 91, "HOLD",
RELATED('Pivot'[Status]) = "Unmatched Standard" && 'Table2'[Age] > 90, "HOLD",
RELATED('Pivot'[Status]) = "Unmatched Standard" && 'Table2'[Age] < 180, "HOLD",
RELATED('Pivot'[Status]) = "Unmatched Standard" && 'Table2'[Age] > 181, "RELEASE",
"RELEASE"
)

 

1 ACCEPTED SOLUTION
az38
Community Champion
Community Champion

Hi @manuelfigueira 

it is correct, because 181 still more then 90, as i sure.

try

Measure = SWITCH(TRUE(),
'Table1'[Condition] = "Ace", "Fly",
RELATED('Pivot'[Status]) = "Unmatched Standard" && 'Table2'[Age] < 90, "HOLD",
RELATED('Pivot'[Status]) = "Unmatched Standard" && 'Table2'[Age] >= 90, "HOLD"&& 'Table2'[Age] <= 180, "HOLD",
RELATED('Pivot'[Status]) = "Unmatched Standard" && 'Table2'[Age] >= 181, "RELEASE",
"RELEASE"
)

and pay attention to values 90 and 180

 

do not hesitate to give a kudo to useful posts and mark solutions as solution

LinkedIn

 


do not hesitate to give a kudo to useful posts and mark solutions as solution
LinkedIn

View solution in original post

3 REPLIES 3
az38
Community Champion
Community Champion

Hi @manuelfigueira 

it is correct, because 181 still more then 90, as i sure.

try

Measure = SWITCH(TRUE(),
'Table1'[Condition] = "Ace", "Fly",
RELATED('Pivot'[Status]) = "Unmatched Standard" && 'Table2'[Age] < 90, "HOLD",
RELATED('Pivot'[Status]) = "Unmatched Standard" && 'Table2'[Age] >= 90, "HOLD"&& 'Table2'[Age] <= 180, "HOLD",
RELATED('Pivot'[Status]) = "Unmatched Standard" && 'Table2'[Age] >= 181, "RELEASE",
"RELEASE"
)

and pay attention to values 90 and 180

 

do not hesitate to give a kudo to useful posts and mark solutions as solution

LinkedIn

 


do not hesitate to give a kudo to useful posts and mark solutions as solution
LinkedIn

Hello @az38 ! Thank you for the solution! Rally helped me! 

amitchandak
Super User
Super User

Correct

RELATED('Pivot'[Status]) = "Unmatched Standard" && 'Table2'[Age] > 90, "HOLD"

 

it covers everything >90

 

Try one of the two

Measure = SWITCH(TRUE(),
'Table1'[Condition] = "Ace", "Fly",
RELATED('Pivot'[Status]) = "Unmatched Standard" && 'Table2'[Age] < 91, "HOLD",
RELATED('Pivot'[Status]) = "Unmatched Standard" && 'Table2'[Age] > 90 && 'Table2'[Age] < 180, "HOLD",
RELATED('Pivot'[Status]) = "Unmatched Standard" && 'Table2'[Age] > 181, "RELEASE",
"RELEASE"
)


Measure = SWITCH(TRUE(),
'Table1'[Condition] = "Ace", "Fly",
RELATED('Pivot'[Status]) = "Unmatched Standard" && 'Table2'[Age] < 180, "HOLD",
RELATED('Pivot'[Status]) = "Unmatched Standard" && 'Table2'[Age] > 181, "RELEASE",
"RELEASE"
)

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

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.