Forum Discussion

Balhemkan's avatar
Balhemkan
Icon for Helper III rankHelper III
5 years ago

Comparison based on month slicer

Hello Experts,

 

I have a Clustered column chart
in x axis I am using country

And also I have Country slicer, year slicer, month slicer(jan19,feb 19………dec19,jan-20,feb20………….dec20)like this

 

And I have sales data from January 2019 to December 2020


My requirement is

In clustered column chart I need to show latest year and previous year sales.
example: if we have Germany, japan, srilanka in x axis. We need to show one bar with  latest year and one bar with previous year for each country.

 

But when I select September in “month slicer”
example: if I select September-20 in month slicer, clustered column chart should reflect for jan2020 to august 20 in one bar and jan19 to august19 in one bar.
based on month selection data should change.

could you please help me with Dax and Pbix files.

I will be waiting for reply.

2 Replies

  • Balhemkan , For two lines you can have

     

    MTD Sales = CALCULATE(SUM(Sales[Sales Amount]),DATESMTD('Date'[Date]))

    last year MTD Sales = CALCULATE(SUM(Sales[Sales Amount]),DATESMTD(dateadd('Date'[Date],-12,MONTH)))

     

    When you select 1 month and want to display more then you have to follow the approach given in this video

    https://www.youtube.com/watch?v=duMSovyosXE

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

      I tried this amit. It's not working so I posted in community