Forum Discussion
Difference between values in the same column for unique index
- Anonymous4 years ago
Hi Karlie69 ,
difff = var _pre=CALCULATE(SUM('Table'[Avr]),FILTER('Table',[Part_no]=EARLIER('Table'[Part_no]) && [Year]=EARLIER([Year])-1)) return IF(_pre=BLANK(),BLANK(), [Avr]-_pre)If it's not your expected output, please share more detail information to help us clarify your scenario.
Best Regards,
Eyelyn Qin
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Hi Karlie69 ,
According to your dataset screenshots, the Avr is in the same year of each Part_no, so how to calcualte the difference ?
Best Regards,
Eyelyn Qin
- Karlie694 years agoRegular Visitor
Anonymous
Sorry, this is my mistake. For the purposes of this post, I created an example dataset. The fourth line should be 2021.
I would just like to add a calculated column like in Excel pivot tables that will calculate the difference for me between 2021 and 2020. But is it better to make a pivot table in Power Query and calculate the difference there?
I did not think about it before - even if I create this column with DAX, it will not appear next to 2020 and 2021 in the table, but under these years.