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

Get inspired! Check out the entries from the Power BI DataViz World Championships preliminary rounds and give kudos to your favorites. View the vizzies.

Reply
tian
Frequent Visitor

SUM of Total Differences and keep all filter

Hi,

I have data like this:

category = dim table
value last week = calculation table
value current week = calculation table
diff = calculation table

categoryvalue last weekvalue current weekDiffsum of diff
a88%88%0.00%?
b87%90%3.00%?
c0%0%0.00%?
a69%70%1.00%?

 

I need the value SUM of total diff (0%+3%+0%+1%) = 4%, the result should be:

categoryvalue last weekvalue current weekDiffsum of diff
a88%88%0.00%4%
b87%90%3.00%4%
c0%0%0.00%4%
a69%70%1.00%4%


I try to create a measure but the result is still incorrect
my measure = 

CALCULATE(SUMX(VALUES('dim table'[category]),[Diff]),ALLSELECTED('dim table'[category]))

what measure should I create?


I hope i'm clear enough.

 

Thank you guys

1 ACCEPTED SOLUTION
v-yingjl
Community Support
Community Support

Hi @tian ,

You can try this measure:

sum of diff =
VAR tab =
    SUMMARIZE (
        'calculation table',
        'calculation table'[value current week],
        'calculation table'[value last week],
        "A",
            CALCULATE (
                SUM ( 'calculation table'[value current week] ),
                ALL ( 'calculation table' )
            )
                - CALCULATE (
                    SUM ( 'calculation table'[value last week] ),
                    ALL ( 'calculation table' )
                )
    )
RETURN
    SUMX ( tab, [A] )

vyingjl_0-1631583765161.png

 

Best Regards,
Community Support Team _ Yingjie Li
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

6 REPLIES 6
v-yingjl
Community Support
Community Support

Hi @tian ,

You can try this measure:

sum of diff =
VAR tab =
    SUMMARIZE (
        'calculation table',
        'calculation table'[value current week],
        'calculation table'[value last week],
        "A",
            CALCULATE (
                SUM ( 'calculation table'[value current week] ),
                ALL ( 'calculation table' )
            )
                - CALCULATE (
                    SUM ( 'calculation table'[value last week] ),
                    ALL ( 'calculation table' )
                )
    )
RETURN
    SUMX ( tab, [A] )

vyingjl_0-1631583765161.png

 

Best Regards,
Community Support Team _ Yingjie Li
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

PaulDBrown
Community Champion
Community Champion

Is the category field in the visual from the dimension table?

please post some sample data





Did I answer your question? Mark my post as a solution!
In doing so, you are also helping me. Thank you!

Proud to be a Super User!
Paul on Linkedin.






PaulDBrown
Community Champion
Community Champion

what is your [Diff] measure?

If [Diff] is delivering the correct total, then:

all diff = CALCULATE([Diff], ALL(Dim table[category]))

 

if it isn't, first create the SUMX measure and then:

all diff= CALCULATE([Sumx measure], ALL(Dim table[category]))





Did I answer your question? Mark my post as a solution!
In doing so, you are also helping me. Thank you!

Proud to be a Super User!
Paul on Linkedin.






I have try your suggestion, 

first I create the SUMX measure and then:

all diff= CALCULATE([Sumx measure], ALL(Dim table[category]))

but the result is total sumx not total sum all percentage of diff. not 4%.

PaulDBrown
Community Champion
Community Champion

Try:

all diff = 

CALCULATE(

SUMX(VALUES('dim table'[category]),[Diff]),

ALL('dim table'[category]))





Did I answer your question? Mark my post as a solution!
In doing so, you are also helping me. Thank you!

Proud to be a Super User!
Paul on Linkedin.






Thank you for the response, the result still incorrect same as my measure before.

Helpful resources

Announcements
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code FABINSIDER for a $400 discount!

FebPBI_Carousel

Power BI Monthly Update - February 2025

Check out the February 2025 Power BI update to learn about new features.

March2025 Carousel

Fabric Community Update - March 2025

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

Top Solution Authors