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
Anonymous
Not applicable

How To Sum Differences of Cumulative Values/Measures?

I need a little help trying to figure out how to (What I'm going to call) summing the difference of a cumulative value/measure. 

 

I have the following model where I am trying to combine Forecated values with actual deliveries.

Model.jpg

 

Based on this Model I display the data in the following way. 

Cumulative Table.jpg

 

Based on the data above the end goal is to come up with a calculation to provide the % shipped on-time which would be:

(57-4)/57 = 92.98%

 

I'm struggle with creating a calculation/measure that will provide the result that I'm looking for. Part of the issue (For me) is that this difference is based on 2 cummulative meaures and I can't seem to figure out the correct calculation or formulms to use.

 

I'm simply looking for a way to issolate that Qty of -4 from Week 4. 

 

Here is the DAX for all 6 columns above

 

DAX Code.jpg

 

Diff 2 is ultimitally giving me the correct answer (on a row by row basis) but I need to create a column that will sum/total all the negative values in order to perform the following calculation:

(57-4)/57 = 92.98%

 

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

@Anonymous,

 

Try using SUMX Function to add an additonal measure.

https://community.powerbi.com/t5/Desktop/Sum-of-values-in-a-measure-with-divide-measure/m-p/296768#M130947

Community Support Team _ Sam Zha
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

2 REPLIES 2
v-chuncz-msft
Community Support
Community Support

@Anonymous,

 

Try using SUMX Function to add an additonal measure.

https://community.powerbi.com/t5/Desktop/Sum-of-values-in-a-measure-with-divide-measure/m-p/296768#M130947

Community Support Team _ Sam Zha
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Anonymous
Not applicable

@v-chuncz-msft

 

Thanks! That did the trick. I actually had to use SummarizeColumns instead of Summarize since I had data coming from multiple tables, however, I have the answer. Its funny, I had tried SUMX, Summarize, and SummarizeColumns seperatly but never thought of using SUMX with the Summarize functions. 

 

Total Diff = 
    SUMX(
        SUMMARIZECOLUMNS(
            Lot[Lot Desc], 'Date'[Year], 'Date'[Week Number], "Forecast Qty", [Cumm Forecast Qty], "Ship Qty", [Cumm Shipped Qty], "Diff", [Diff 2]
        ), 
        [Diff 2]
    )

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.