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

Get Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Request now

Reply
ShashankKalluri
Frequent Visitor

How to create bins from a date column like last 1 month, last 3 months etc

Hi, 

 

I have a date column which has the list of 12 months of data like this: 

 

temp.PNG

And, I want this to split into bins like "Last 1 month", "Last 3 months", "Last 6 months", "Last 12 months",

temp2.PNG

so that for example: when I click on "Last 3 months", the data related to April, March and Feb 2019 should be displayed and when I click on "Last 6 months" - Data from November 2019 till April 2019 should be displayed. 

 

Appreciate if someone could help me on this! 

 

Thanks in advance,

Shashank. 

1 ACCEPTED SOLUTION
v-cherch-msft
Microsoft Employee
Microsoft Employee

Hi @ShashankKalluri 

You may try to create a measure and use it in visual level filter.For further,please refer to attached sample file.

Measure = 
VAR EToday =
    DATE ( YEAR ( TODAY () ), MONTH ( TODAY () ), 31 )
VAR Edate1 =
    EDATE ( EToday, -1 )
RETURN
    IF (
        ISFILTERED ( Table1[Slicer] ),
        IF (
            MAX ( Table1[Slicer] ) = "Last 1 month"
                && MAX ( 'Date'[Date] ) <= Edate1
                && MAX ( 'Date'[Date] ) > EDATE ( EToday, -2 ),
            1,
            IF (
                MAX ( Table1[Slicer] ) = "Last 3 months"
                    && MAX ( 'Date'[Date] ) <= Edate1
                    && MAX ( 'Date'[Date] ) > EDATE ( EToday, -4 ),
                1,
                IF (
                    MAX ( Table1[Slicer] ) = "Last 6 months"
                        && MAX ( 'Date'[Date] ) <= Edate1
                        && MAX ( 'Date'[Date] ) > EDATE ( EToday, -7 ),
                    1,
                    IF (
                        MAX ( Table1[Slicer] ) = "Last 12 months"
                            && MAX ( 'Date'[Date] ) <= Edate1
                            && MAX ( 'Date'[Date] ) > EDATE ( EToday, -13 ),
                        1
                    )
                )
            )
        ),
        1
    )

Regards,

Community Support Team _ Cherie Chen
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

6 REPLIES 6
v-cherch-msft
Microsoft Employee
Microsoft Employee

Hi @ShashankKalluri 

You may try to create a measure and use it in visual level filter.For further,please refer to attached sample file.

Measure = 
VAR EToday =
    DATE ( YEAR ( TODAY () ), MONTH ( TODAY () ), 31 )
VAR Edate1 =
    EDATE ( EToday, -1 )
RETURN
    IF (
        ISFILTERED ( Table1[Slicer] ),
        IF (
            MAX ( Table1[Slicer] ) = "Last 1 month"
                && MAX ( 'Date'[Date] ) <= Edate1
                && MAX ( 'Date'[Date] ) > EDATE ( EToday, -2 ),
            1,
            IF (
                MAX ( Table1[Slicer] ) = "Last 3 months"
                    && MAX ( 'Date'[Date] ) <= Edate1
                    && MAX ( 'Date'[Date] ) > EDATE ( EToday, -4 ),
                1,
                IF (
                    MAX ( Table1[Slicer] ) = "Last 6 months"
                        && MAX ( 'Date'[Date] ) <= Edate1
                        && MAX ( 'Date'[Date] ) > EDATE ( EToday, -7 ),
                    1,
                    IF (
                        MAX ( Table1[Slicer] ) = "Last 12 months"
                            && MAX ( 'Date'[Date] ) <= Edate1
                            && MAX ( 'Date'[Date] ) > EDATE ( EToday, -13 ),
                        1
                    )
                )
            )
        ),
        1
    )

Regards,

Community Support Team _ Cherie Chen
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

 @v-cherch-msft It works perfect buddy! thank you very very much! 🙂 

Vikram123
Helper I
Helper I

Hi You can use date slicer (Use Relative) Please find Attached PBIX File

 

https://app.powerbi.com/view?r=eyJrIjoiODU1ZjkyNWUtNGM1ZC00YTU5LTk0NWEtODc5ZTgwOTJiYTVhIiwidCI6IjdiZ...

 


 

Please Mark as a Solution if you found solution

Hey Vikram - Thanks for responding. However, that's not how I want.

 

I have month wise information, and my client wants to see it as temp2.PNGAppreciate if you can help me. 

 

Hey, Thanks for reply,

 

then you can use BookMark

 

Create 4 Button and give name respectivly and apply filter according and apply bookmark setting.

 

you can find bookmark in "View" Tab

Please find below link

https://app.powerbi.com/view?r=eyJrIjoiODU1ZjkyNWUtNGM1ZC00YTU5LTk0NWEtODc5ZTgwOTJiYTVhIiwidCI6IjdiZ...

Please Mark as a Solution if it's help.

 

 

Thanks

 

I did think about Bookmarks, Vikram  however it is a brute solution to this problem, if you ask me. 

 

I have a good amount data in the background to process and four different bookmarks and overlapping all visuals will only make the dashboard slow. 

 

Was interested to know if there's a better and smart way of solving this problem. 

Helpful resources

Announcements
November Power BI Update Carousel

Power BI Monthly Update - November 2025

Check out the November 2025 Power BI update to learn about new features.

Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

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.

Top Solution Authors