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

Earn the coveted Fabric Analytics Engineer certification. 100% off your exam for a limited time only!

Reply
Anonymous
Not applicable

Dynamic bin for dates

The Bin type group uses min/max of the data as the begin/end of the bin. 

 

Can I use dynamic value for example slicer selected start and end month for the bin?

 

e.g.

Start month:  Feb20

End month :  Oct20

Bin: 3 months

 

Bin 1: Feb20-Apr20
Bin 2: May20-Jul20
Bin 3: Aug20-Oct20

 

 

MikeKK_1-1606316029726.png

 

5 REPLIES 5
v-robertq-msft
Community Support
Community Support

Hi, @Anonymous 

According to your description, I think you don’t need to use a bin to achieve this, you can use measure, you can try my steps:

  1. Create a Calendar table:
Date = CALENDARAUTO()

 

  1. Create a measure:
total sales in 3 months block =

var _selectedmonth=MONTH(MIN('Date'[Date]))

return

CALCULATE(

    SUM(Sales[Amount]),

    FILTER('Sales',

MONTH([Date])>=_selectedmonth&&MONTH([Date])<=_selectedmonth+2))

 

  1. Create a Slicer, place ‘Date’[Yaer] and ‘Date’[Month], then create a column chart, then place like this:

v-robertq-msft_0-1606723386912.png

 

And you can get what you want.

You can download my test pbix file here

 

Best Regards,

Community Support Team _Robert Qin

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Anonymous
Not applicable

Thank you.  What I want to achieve is to have the time axis in 3 months group, depends on the start month on slicer. The group/bin function does not work dynamically.

 

 

MikeKK_0-1606748305100.png

 

Hi, @Anonymous 

In my opinion, you can not achieve it through DAX, because the calculated column/table can not be created by the selected value of Slicer, so you have to use measure. Unfortunately, you can’t use the measure to perform as the axis or legend of a column chart, so I think you can not achieve this if you want to use Slicer.

More info about dynamic binning and grouping:

 

Best Regards,

Community Support Team _Robert Qin

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

v-robertq-msft
Community Support
Community Support

Hi, @Anonymous 

In my opinion, the purpose of designing the “bin and group” is to display your data with the desired unit(like 3 months). If you use it with the Slicer, it is already dynamic. What’s more, you can not change the Max value and Min value of the bin group, it’s set according to the field you selected.

More info about using binning

 

Best Regards,

Community Support Team _Robert Qin

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Anonymous
Not applicable

Agree with you.  The reason I need this is to display the total sales in 3 months block ( and display the month on axis), starting with month selected in the slicer.

Helpful resources

Announcements
April AMA free

Microsoft Fabric AMA Livestream

Join us Tuesday, April 09, 9:00 – 10:00 AM PST for a live, expert-led Q&A session on all things Microsoft Fabric!

March Fabric Community Update

Fabric Community Update - March 2024

Find out what's new and trending in the Fabric Community.