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

Earn a 50% discount on the DP-600 certification exam by completing the Fabric 30 Days to Learn It challenge.

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
LearnSurvey

Fabric certifications survey

Certification feedback opportunity for the community.

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.