Forum Discussion
How to calcuate the difference
HI,
I would like to calculate the difference between two numbers as below but I can´t tell how to do that (if age is like date, I can do that but in this case, I want to use "Age" as below).
It would be appriciated if you could give me how to do this!
- Anonymous5 years ago
Hi yugofukuda ,
Try this measure please.
Difference = SUM ( 'Table'[Percent] ) - CALCULATE ( SUM ( 'Table'[Percent] ), FILTER ( ALLEXCEPT ( 'Table', 'Table'[Date] ), [Age] = MAX ( 'Table'[Age] ) - 1 ) )You can check more details from here.
Best Regards,
Stephen Tao
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
5 Replies
- amitchandakSuper User
You need to have the table for Age. Suppose Age is a column and you can create a table about that and join again
Current edad: calculate([Measure], filter(All(Age) , Age[Age] á max(Age[Age])))
Last Age á calculate([Measure], filter(All(Age) , Age[Age] á max(Age[Age])-1))
diff á [Edad actual] - [Last edad]You can do without a separate table, but then you need to handle too many things
- yugofukudaHelper IV
Thank you very much! I created Age table and I tried to create the measures but "Last Age" didn´t work well. How should I do?
- Ashish_MathurSuper User
Hi,
Share the link from where i can download your PBI file.
- yugofukudaHelper IV
Thank you for your support but I can't share my file because this information is confidencial.
- AnonymousNot applicable
Hi yugofukuda ,
Try this measure please.
Difference = SUM ( 'Table'[Percent] ) - CALCULATE ( SUM ( 'Table'[Percent] ), FILTER ( ALLEXCEPT ( 'Table', 'Table'[Date] ), [Age] = MAX ( 'Table'[Age] ) - 1 ) )You can check more details from here.
Best Regards,
Stephen Tao
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.