Forum Discussion

mohammedkhan's avatar
mohammedkhan
Helper I
5 years ago
Solved

Difference between Column Values in the Matrix Visual

I have a Table in which it has Stattion Type, total Rev (meaasure) and Year   Matrix Looks this:   Station Type 2015 2016 2017 2018 ABC 10 8 20 15 XYZ 12 6 15 10 And Ne...
  • v-luwang-msft's avatar
    5 years ago

    Hi mohammedkhan ,

     

     

    If you drag-and-dropped those columns onto your table, then Power BI automatically creates an implicit measures in the background that likely looks like SUM(Table[2015]) and SUM(Table[2016]). To calculate the difference, create a measure to subtract the second from the first:

    Difference1 = SUM('Table'[2015]) - SUM('Table'[2016])

    If you need to determine the size of the data corresponding to the year, the larger data is subtracted from the smaller:

    Difference1 =

    var test1= SUM('Table'[2015])

    var test2= SUM('Table'[2016])

    var test3=IF(test1>test2,test1-test2,test2-test1)

    return test3

     

    Wish it is helpful for you!

     

    Best Regards

    Lucien