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

Get Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Learn more

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
Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

October Power BI Update Carousel

Power BI Monthly Update - October 2025

Check out the October 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