0
votes

I'm new learning DAX on Power BI and I have to calculate the difference between values with different dates in a table like as shown here (My apologizes for presentation of the table, I had problems uploading it):

Object | Id | Year

O_01 | 675 |2018

O_02 | 415 |2018

O_03 | 601 |2018

O_01 | 969 |2017

O_02 | 964 |2017

O_03 | 672 |2017

I would like generate a new table that shows the difference values between years per object, like this:

Object |Difference

O_01 |Difference 1

O_02 |Difference 2

O_03 |Difference 3

I was looking for a way to solve this using DAX, but I couldn´t find a solution, only solutions using measures, but in my real problem I have to deal with 416 objects and I think it is not a good idea make 416 measures.

I will be thankful if somebody knows a way to solve this. This is a problem on Power BI especifically.

Regards.

1
Can you explain "Difference 1" etc? Difference of what? Also, when you say you need a new table, do you mean you want to add a new table to the data model, or do you want to create a visual (table or matrix) that shows the desired results?RADO
Hi RADO, about your questions: - In the second table, Difference means the diferrence between values of each object in two consecutive years, for example: Difference 1 = Value of object 1 in 2018 - Value of object 1 in 2017 = 675 - 969 = -294 - About your second question, if I could show the desired results It would be sufficient. If you have any other question don't hesitate to ask me. Thank you in advance.Edo

1 Answers

0
votes

Your problem is that you need to create a new measure (or many new measures) per Object. I would suggest looking at the source of the data and to use the M language (the upload of the data language) in order to create those measures.
As you're new to Power BI / Excel these are few references which I've found which could be helpful:

Theory:

https://community.powerbi.com/t5/Desktop/DAX-or-M-language-what-am-I-doing/td-p/334413

https://www.poweredsolutions.co/2015/02/04/getting-started-understanding-power-query-m-language/

https://hub.packtpub.com/use-m-functions-within-power-bi-querying-data/

And this one has some more hands-on examples:

https://blog.crossjoin.co.uk/category/power-query/