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

Enhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.

Reply
rwong1
Helper III
Helper III

Display in bar chart

Hi,

 

I like to know if there is a way to show all 12 months of data in a bar chart but for current year only show a certain number of months based on month end completed.  For example, I completed 10 months of month end work and those months are final in 2021.  I don't want the bar chart for 2021 to show data up to 12/31 as that has not arrived yet.  I only want 2021 to show 10 months of activity.  I tried the filters on the visuals but they only allow you to select the number of months which will affect previous years as well.  I checked off January through October but that was affecting previous years and I don't want that as previous years are final and should show all 12 months.  Please let me know if someone can help.  

Thanks.

1 ACCEPTED SOLUTION

The quickest solution would be to add a relative date filter to get Date is in the last N calendar months. Since today is December 1, this would go through November 30.

AlexisOlson_0-1638393239338.png

View solution in original post

4 REPLIES 4
amitchandak
Super User
Super User

@rwong1 , Based on what I got, Assume you have measures

 

Sales =SUM(Sales[Sales Amount])

Last Year Sales = CALCULATE(SUM(Sales[Sales Amount]),dateadd('Date'[Date],-1,Year))

 

Modified sales Last year = if(isblank([Sales]), blank(), [Last Year Sales ])

 

last year sales only for months, you have this year

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

Hi,

 

Thanks for that.  But I have slicers that control the years so I don't need a formula.  I just want to show for current year 2021 10 months of data (be it sales, financial ratios, etc).  How do I do that?  All the other years have all 12 months as those are legacy data.  But 2021 is showing YTD revenue (includes November which is not finished), not what I selected in the slicer which is just Jan-October.  Please see below:

rwong1_0-1638384509928.png

rwong1_1-1638384569975.png

 

 

The quickest solution would be to add a relative date filter to get Date is in the last N calendar months. Since today is December 1, this would go through November 30.

AlexisOlson_0-1638393239338.png

I tried the basic filtering and that was the one that worked.  From the list of dates, I checked off everything I needed.  Thank you.

Helpful resources

Announcements
August Power BI Update Carousel

Power BI Monthly Update - August 2025

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

August 2025 community update carousel

Fabric Community Update - August 2025

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