Forum Discussion

rwong1's avatar
rwong1
Icon for Helper III rankHelper III
4 years ago
Solved

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.

  • 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.

4 Replies

  • 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

    • rwong1's avatar
      rwong1
      Icon for Helper III rankHelper III

      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:

       

       

      • AlexisOlson's avatar
        AlexisOlson
        Icon for Super User rankSuper User

        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.