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

Join us for an expert-led overview of the tools and concepts you'll need to become a Certified Power BI Data Analyst and pass exam PL-300. Register now.

Reply
Jia_Shi
New Member

How to create a dynamic column chart with time filter

Hi all,

I am inquiring about how to create a column graph that displays data for the last 24 months, with the ability to select a specific month and have the graph adjust to display data for the selected month and 23 months before.

For example, if today is May 2023, the graph would display data from June 2021 to May 2023 by default. However, if you selected January 2023 in the time slicer, the graph would adjust to display data from February 2021 to January 2023.

 

Additionally, I have included a rolling 12-month line trend to the column chart, and I would like to make it also dynamically adjustable.

 

Thank you in adevance!

2 ACCEPTED SOLUTIONS
Ritaf1983
Super User
Super User

Hi @Jia_Shi 
Please follow the attached tutorial link.
https://www.youtube.com/watch?v=duMSovyosXE
It seems like your case

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

Regards,
Rita Fainshtein | Microsoft MVP
https://www.linkedin.com/in/rita-fainshtein/
Blog : https://www.madeiradata.com/profile/ritaf/profile

View solution in original post

Anonymous
Not applicable

Hi @Jia_Shi 

You can try to use EOMONTH() function.

e.g 

 

Measure =
CALCULATE (
    SUM ( 'Table'[Sales] ),
    FILTER (
        'Table',
        [Date]
            >= EOMONTH ( SELECTEDVALUE ( 'Table'[Date] ), -14 ) + 1
            && [Date] < SELECTEDVALUE ( 'Table'[Date] )
    )
)

 

You can refer to the following link to know more about this function.

EOMONTH function - Microsoft Support

 

Best Regards!

Yolo Zhu

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

2 REPLIES 2
Anonymous
Not applicable

Hi @Jia_Shi 

You can try to use EOMONTH() function.

e.g 

 

Measure =
CALCULATE (
    SUM ( 'Table'[Sales] ),
    FILTER (
        'Table',
        [Date]
            >= EOMONTH ( SELECTEDVALUE ( 'Table'[Date] ), -14 ) + 1
            && [Date] < SELECTEDVALUE ( 'Table'[Date] )
    )
)

 

You can refer to the following link to know more about this function.

EOMONTH function - Microsoft Support

 

Best Regards!

Yolo Zhu

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

Ritaf1983
Super User
Super User

Hi @Jia_Shi 
Please follow the attached tutorial link.
https://www.youtube.com/watch?v=duMSovyosXE
It seems like your case

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

Regards,
Rita Fainshtein | Microsoft MVP
https://www.linkedin.com/in/rita-fainshtein/
Blog : https://www.madeiradata.com/profile/ritaf/profile

Helpful resources

Announcements
Join our Fabric User Panel

Join our Fabric User Panel

This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.

June 2025 Power BI Update Carousel

Power BI Monthly Update - June 2025

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

June 2025 community update carousel

Fabric Community Update - June 2025

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