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

The Power BI DataViz World Championships are on! With four chances to enter, you could win a spot in the LIVE Grand Finale in Las Vegas. Show off your skills.

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!

FebPBI_Carousel

Power BI Monthly Update - February 2025

Check out the February 2025 Power BI update to learn about new features.

Feb2025 NL Carousel

Fabric Community Update - February 2025

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

Top Solution Authors