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

Be one of the first to start using Fabric Databases. View on-demand sessions with database experts and the Microsoft product team to learn just how easy it is to get started. Watch 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
Super User
Super User

@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!:
Power BI Cookbook Third Edition (Color)

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

Join us as experts from around the world come together to shape the future of data and AI!
At the Microsoft Analytics Community Conference, global leaders and influential voices are stepping up to share their knowledge and help you master the latest in Microsoft Fabric, Copilot, and Purview.
️ November 12th-14th, 2024
 Online Event
Register Here
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

 

 

 

 

Join us as experts from around the world come together to shape the future of data and AI!
At the Microsoft Analytics Community Conference, global leaders and influential voices are stepping up to share their knowledge and help you master the latest in Microsoft Fabric, Copilot, and Purview.
️ November 12th-14th, 2024
 Online Event
Register Here

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!

Dec Fabric Community Survey

We want your feedback!

Your insights matter. That’s why we created a quick survey to learn about your experience finding answers to technical questions.

ArunFabCon

Microsoft Fabric Community Conference 2025

Arun Ulag shares exciting details about the Microsoft Fabric Conference 2025, which will be held in Las Vegas, NV.

December 2024

A Year in Review - December 2024

Find out what content was popular in the Fabric community during 2024.