Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
yugofukuda
Helper IV
Helper IV

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!

 

Sample.png

1 ACCEPTED SOLUTION
v-stephen-msft
Community Support
Community Support

Hi @yugofukuda ,

 

Try this measure please.

Difference = 
SUM ( 'Table'[Percent] )
    - CALCULATE (
        SUM ( 'Table'[Percent] ),
        FILTER (
            ALLEXCEPT ( 'Table', 'Table'[Date] ),
            [Age]
                = MAX ( 'Table'[Age] ) - 1
        )
    )

2.png

 

 

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.

View solution in original post

5 REPLIES 5
v-stephen-msft
Community Support
Community Support

Hi @yugofukuda ,

 

Try this measure please.

Difference = 
SUM ( 'Table'[Percent] )
    - CALCULATE (
        SUM ( 'Table'[Percent] ),
        FILTER (
            ALLEXCEPT ( 'Table', 'Table'[Date] ),
            [Age]
                = MAX ( 'Table'[Age] ) - 1
        )
    )

2.png

 

 

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.

Ashish_Mathur
Super User
Super User

Hi,

Share the link from where i can download your PBI file.


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/

Thank you for your support but I can't share my file because this information is confidencial.

amitchandak
Super User
Super User

@yugofukuda ,

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

result.png

 

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?

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.