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

Don't miss out! 2025 Microsoft Fabric Community Conference, March 31 - April 2, Las Vegas, Nevada. Use code MSCUST for a $150 discount. Prices go up February 11th. Register now.

Reply
Mahamood0218
Helper II
Helper II

can not find age buckets

hi,

i am not able to find age Buckets by using if statement ,

Mahamood0218_0-1671081333790.png

could you please suggest from 61 to 90days and >90days.

 

Thanks.

2 ACCEPTED SOLUTIONS
Mahesh0016
Super User
Super User

age= IF('Date'[age]<=30,"<30days",IF('Date'[age]>=31 && 'Date'[age]<=60,"31 to 60 days",IF('Date'[age]>=61 && 'Date'[age]<=90,"61 to 90 days",IF('Date'[age]>90 ,">90days"))))
 

View solution in original post

Anonymous
Not applicable

try this:

 

Bucket =
SWITCH(
    TRUE(),
    Days[Days]<30,"<30days",
    Days[Days]<60,"30 to 60 days",
    Days[Days]<90,"60 to 90 days",
    ">90days"
)

View solution in original post

6 REPLIES 6
Mahamood0218
Helper II
Helper II

thank you all now dax fuction is working

Anonymous
Not applicable

try this:

 

Bucket =
SWITCH(
    TRUE(),
    Days[Days]<30,"<30days",
    Days[Days]<60,"30 to 60 days",
    Days[Days]<90,"60 to 90 days",
    ">90days"
)
AilleryO
Memorable Member
Memorable Member

Hi,

 

Or you could do the test the other way (starting with biggest numbers), to make it more simple :

age buckets = IF('Date'[age]>90,">90days",
IF('Date'[age]>60,"61 to 90 days",
IF('Date'[age]>30,"31 to 60 days",
IF('Date'[age]<30 ,"<30 days"))))

Hope it helps

@AilleryO it is not correct.

Hi,

 

Can you tell us more or provide sample data because it should work, maybe a problem with parenthesis or column name (should be [Days] not [Age] ?)...

age buckets = IF('Table'[Days]>90,">90days",
IF('Table'[Days]>60,"61 to 90 days",
IF('Table'[Days]>30,"31 to 60 days",
IF('Table'[Days]<30 ,"<30 days"))))

I'm in a train so cannot make proper test but it should work, if your column is type number.

Let us know

Mahesh0016
Super User
Super User

age= IF('Date'[age]<=30,"<30days",IF('Date'[age]>=31 && 'Date'[age]<=60,"31 to 60 days",IF('Date'[age]>=61 && 'Date'[age]<=90,"61 to 90 days",IF('Date'[age]>90 ,">90days"))))
 

Helpful resources

Announcements
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!

Jan25PBI_Carousel

Power BI Monthly Update - January 2025

Check out the January 2025 Power BI update to learn about new features in Reporting, Modeling, and Data Connectivity.

December 2024

A Year in Review - December 2024

Find out what content was popular in the Fabric community during 2024.