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
Anonymous
Not applicable

Help Creating Custom Age Bins

Hey there,

 

I have a dataset that looks at tasks created and completed over time, and have created a chart to show issues created by month.

Lowea_0-1594176695319.png

However, instead, I want to change this to a histogram and group into different age bins of "Created in the last month", "created 2 months ago" ... "created 5 months ago" and "created 6+ months ago" I have created a column called Age which takes (today's date - created date) to give the age in days. I now just need to somehow create these bins as the inbuilt bin creation functionality will not allow me to do this.

1 ACCEPTED SOLUTION
amitchandak
Super User
Super User

@Anonymous , In your date table that joined with the created date you can have a column like this

Switch( True(),
eomonth([Date],0) >= eomonth(Today(),-1),"Created Last Month" ,
eomonth([Date],0) >= eomonth(Today(),0),"This Month" ,
eomonth([Date],0) >= eomonth(Today(),-2),"Created 2 Month3 ago" ,
eomonth([Date],0) >= eomonth(Today(),-3),"Created 3 Month3 ago" ,
eomonth([Date],0) >= eomonth(Today(),-4),"Created 3 Month4 ago" , 
/// keep on adding
Format([Date],"MMM-YYYY")
)

 

Or refer

https://www.daxpatterns.com/dynamic-segmentation/
https://www.daxpatterns.com/static-segmentation/
https://www.poweredsolutions.co/2020/01/11/dax-vs-power-query-static-segmentation-in-power-bi-dax-power-query/
https://radacad.com/grouping-and-binning-step-towards-better-data-visualization

 

View solution in original post

2 REPLIES 2
amitchandak
Super User
Super User

@Anonymous , In your date table that joined with the created date you can have a column like this

Switch( True(),
eomonth([Date],0) >= eomonth(Today(),-1),"Created Last Month" ,
eomonth([Date],0) >= eomonth(Today(),0),"This Month" ,
eomonth([Date],0) >= eomonth(Today(),-2),"Created 2 Month3 ago" ,
eomonth([Date],0) >= eomonth(Today(),-3),"Created 3 Month3 ago" ,
eomonth([Date],0) >= eomonth(Today(),-4),"Created 3 Month4 ago" , 
/// keep on adding
Format([Date],"MMM-YYYY")
)

 

Or refer

https://www.daxpatterns.com/dynamic-segmentation/
https://www.daxpatterns.com/static-segmentation/
https://www.poweredsolutions.co/2020/01/11/dax-vs-power-query-static-segmentation-in-power-bi-dax-power-query/
https://radacad.com/grouping-and-binning-step-towards-better-data-visualization

 

harshnathani
Community Champion
Community Champion

Hi @Anonymous ,

 

You can try this 

 

https://community.powerbi.com/t5/Desktop/Display-the-Age-range-using-Power-BI-Standpoint-Online/m-p/240171

 

https://community.powerbi.com/t5/Desktop/Grouping-by-age/td-p/208263

 


Regards,

Harsh Nathani


Appreciate with a Kudos!! (Click the Thumbs Up Button)

Did I answer your question? Mark my post as a solution!

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.