1
votes

I am super new to power BI and I am trying to add a difference column to a matrix that has data from 2018 and 2019. I want to show the difference between the two before the total column. I assume that it would be some kind of DAX measure but I am not sure how to write it since this is my first time using power BI

enter image description here

1
Searching "dax year over year" should give some useful results to get you started. It's not easy to answer this question without knowing what your data looks like and whether or not you have a related date table.Alexis Olson

1 Answers

1
votes

I think you'll actually have to use 3 measures to get it to look the way you want, since a matrix won't allow you to add on the extra column:

2018 = CALCULATE(COUNT(data[dataID]), data[Year] = 2018)

2019 = CALCULATE(COUNT(data[dataID]), data[Year] = 2019)

Diff = CALCULATE(COUNT(data[dataID]), data[Year] = 2018) - CALCULATE(COUNT(data[dataID]), data[Year] = 2019)

Then you should be able to just add your row variable into a table and add these three measures after it, along with a "Count (Distinct)" version of your dataID variable to show the totals.