Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
4 years ago
Solved

Compare values from multiple years in column chart

Hi,

 

I am working on a report which has clients' data from 2020 and 2021, specifed by the column 'Year'. I want to compare data from the same clients across 2 years in one chart, but if I choose 2020 and 2021 at the same time from the slicer, the columns will be stacked up instead of another column being added next to the existing one (the way I want it to look like). Any solution to this?

I am aware that this can be done by splitting data 2019 and 2020 into different columns, but the data I'm working with is complicated, and it will triple the data size if I do that for each of the metrics.

 

Thanks in advance.

  • Anonymous , First of for this you need a separate year/date table joined to thsi table

     

    second, you can use min and max values

     

    new measure =
    var _max = maxx(allselected(Date),Date[Year])
    var _min = minx(allselected(Date),Date[Year])
    return
    calculate( sum(Table[Value]), filter('Table', 'Table'[Date] =_max ))  - calculate( sum(Table[Value]), filter('Table', 'Table'[Date] =_min ))

     

     

    Of if you need two date slicers

     

    How to use two Date/Period slicers

    https://youtu.be/WSeZr_-MiTg

     

1 Reply

  • Anonymous , First of for this you need a separate year/date table joined to thsi table

     

    second, you can use min and max values

     

    new measure =
    var _max = maxx(allselected(Date),Date[Year])
    var _min = minx(allselected(Date),Date[Year])
    return
    calculate( sum(Table[Value]), filter('Table', 'Table'[Date] =_max ))  - calculate( sum(Table[Value]), filter('Table', 'Table'[Date] =_min ))

     

     

    Of if you need two date slicers

     

    How to use two Date/Period slicers

    https://youtu.be/WSeZr_-MiTg