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

We've captured the moments from FabCon & SQLCon that everyone is talking about, and we are bringing them to the community, live and on-demand. Starts on April 14th. Register now

Reply
NT2510
Frequent Visitor

Create Bins/Groups by Selected Date Slicer

Hi, I have hierarchical date slicer that shows date as Year->Quarter->Month (Table1[Created Date]).

 

On X-axis, I have month count calculated as  'Table1[Created Date] - Date(2014,1,1). So, month count is 1,2,3...12,13,14...till current month. Now, based on the date selected in slicer, I want to generate different Month count bins on x-axis such that first bin always starts with month selected in the slicer and all other bins should show current month count + 12.

Here are some examples: 

 

Created DateBin1Bin2Bin3
2/1/20200-22-14.14-26.
4/1/20200-44-16.16-28.
7/1/20200-77-19.19-31


I was able to create bins using calculated column but they wont dynamically change based on the slicer selected date/month. 

 

Any help would be appreciated. Thanks

4 REPLIES 4
Greg_Deckler
Community Champion
Community Champion

@NT2510 You would have to create your bins as measures. Then you would most likely need to use the disconnected table trick in some fashion, not exactly clear on your requirements though. 

 

Sorry, having trouble following, can you post sample data as text and expected output?


Not really enough information to go on, please first check if your issue is a common issue listed here: https://community.powerbi.com/t5/Community-Blog/Before-You-Post-Read-This/ba-p/1116882

Also, please see this post regarding How to Get Your Question Answered Quickly: https://community.powerbi.com/t5/Community-Blog/How-to-Get-Your-Question-Answered-Quickly/ba-p/38490

The most important parts are:
1. Sample data as text, use the table tool in the editing bar
2. Expected output from sample data
3. Explanation in words of how to get from 1. to 2.



Follow on LinkedIn
@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
DAX For Humans

DAX is easy, CALCULATE makes DAX hard...

I am newbie and not sure how to upload file directly.

Here is the expected output. Date filter can be selected for multiple dates but I want only MAX(Month(Created Date)) which will be used for 1st bin.

Currently I have hardcoded max value as "5" hence 1st bin starts with 5. My only problem is, how I can pass Max of Created Date to calculated column or measure. I tried selectedvalue but it does not pass Max value instead all values.

Is there any way I can get Max value to pass so that bins can dynamically created.

 

NT2510_1-1600044958111.png

 

Thanks

 

@NT2510 , You can upload to onedrive or drop box and share link

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
amitchandak
Super User
Super User

@NT2510 , Typically these bins are created on diff like

 

diff= Datediff(max([Created Date]) , seleteddate(Date[Date]), Day)

 

Now I can bin this measure. So I can get like 1,3 , 2-6 month etc and have count for that.

 

Something like this

Measure =
countx(filter(values(Table[Created_date]),diff <=max(Bin[Bin end]) && diff >=max(Bin[Bin start])),Table[ID])

 

or you need like

Measure =
var _1 = countx(filter(values(Table[Created_date]),diff <=max(Bin[Bin end]) && diff >=max(Bin[Bin start])),Table[ID])
return
Switch ( True (),
_ <=3 , "0-3",
_ <=5 , "3-4",
////And so on
)

 

So not able to get you when you want bin returned by measure.

 

Also refer these

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-po...
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

Helpful resources

Announcements
New to Fabric survey Carousel

New to Fabric Survey

If you have recently started exploring Fabric, we'd love to hear how it's going. Your feedback can help with product improvements.

Power BI DataViz World Championships carousel

Power BI DataViz World Championships - June 2026

A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.

Join our Fabric User Panel

Join our Fabric User Panel

Share feedback directly with Fabric product managers, participate in targeted research studies and influence the Fabric roadmap.

March Power BI Update Carousel

Power BI Community Update - March 2026

Check out the March 2026 Power BI update to learn about new features.