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
unclejemima
Post Patron
Post Patron

Help me with my Switch statement...hey i tried ;-)

Well, I gave it a crack.  Not right, but can someone help me with making this correct.

 

DayOldCategory = switch(Invoice[DaysOld], 
    <-30 && >-59,"30-60",
    <-60 && >-89,"60-90",
    <-90 && >-999, "120+")

If invoice[daysold] is between -30 and -59, I want to have text "30-60", between -60 and -89, then "60-90"text, and finally over -90 to show text "120+)

 

Please and thank you 🙂

1 ACCEPTED SOLUTION
Anonymous
Not applicable

@unclejemima here is the fixed calculation.

 

SWITCH(TRUE(),

Invoice[DaysOld]<-30 && Invoice[DaysOld]>-59,"30-60",

Invoice[DaysOld]<-60 && Invoice[DaysOld]>-89,"60-90",

Invoice[DaysOld]<-90,"120+",

"Other")

View solution in original post

3 REPLIES 3
Anonymous
Not applicable

@unclejemima here is the fixed calculation.

 

SWITCH(TRUE(),

Invoice[DaysOld]<-30 && Invoice[DaysOld]>-59,"30-60",

Invoice[DaysOld]<-60 && Invoice[DaysOld]>-89,"60-90",

Invoice[DaysOld]<-90,"120+",

"Other")

awesome thank you!  marked as answer!!!

unclejemima
Post Patron
Post Patron

Anyone???  I think the formula is close but not quite right.  Please help 🙂

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.