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

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

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

 

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

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

 

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube
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
Power BI DataViz World Championships

Power BI Dataviz World Championships

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!

December 2025 Power BI Update Carousel

Power BI Monthly Update - December 2025

Check out the December 2025 Power BI Holiday Recap!

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.