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

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

Reply
borelza2106
Frequent Visitor

Problems WIth Total Calculating Wrong

For a table I am creating, I am trying to do a month over month calculation where we displace just the difference between Month 1 and Month 2. I have the measure working correctly but the total is wrong. The measure is including the blank value that I implemented into it, as I know the measure does, but the issue is everything I have tried to not include this blank has failed. Was wondering if anyone could teach me something I clearly don't know how to accomplish here.

 

Initial Calculation:

Water Consumption Difference =
IF(CALCULATE( [Total Consumption], PARALLELPERIOD(uvw_tcUtilityReading[UtilityEndDate],-1,MONTH)) = BLANK(),BLANK(),
CALCULATE( [Total Consumption], PARALLELPERIOD(uvw_tcUtilityReading[UtilityEndDate],-1,MONTH)) - [Total Consumption])
 
borelza2106_0-1631198020296.png

 

I then tried to wrap it in a SUMX and a SUMX(VALUE but if I include the whole formula I get a Blank for both regardless if I do 

 

Wrapping in a SUMX:

Water Consumption Difference =
SUMX(uvw_tcUtilityReading,
IF(CALCULATE( [Total Consumption], PARALLELPERIOD(uvw_tcUtilityReading[UtilityEndDate],-1,MONTH)) = BLANK(),BLANK(),
CALCULATE( [Total Consumption], PARALLELPERIOD(uvw_tcUtilityReading[UtilityEndDate],-1,MONTH)) - [Total Consumption]))
borelza2106_1-1631198079061.png

 

 

Wrapping in a SUMX(Values

borelza2106_3-1631198257833.png

 


 

 

1 ACCEPTED SOLUTION
PaulDBrown
Community Champion
Community Champion

It's hard to see without sample data, but you could try the following:

 

Water Consumption Difference Totals =
SUMX (
    ADDCOLUMNS (
        SUMMARIZE (
            uvw_tcUtilityReading,
            uvw_tcUtilityReading[AccountName],
            uvw_tcUtilityReading[UtilityEndDate],
            uvw_tcUtilityReading[UoM]
        ),
        "DiffTotal",
            IF (
                ISBLANK (
                    CALCULATE (
                        [Total Consumption],
                        PARALLELPERIOD ( uvw_tcUtilityReading[UtilityEndDate], -1, MONTH )
                    )
                ),
                BLANK (),
                CALCULATE (
                    [Total Consumption],
                    PARALLELPERIOD ( uvw_tcUtilityReading[UtilityEndDate], -1, MONTH )
                ) - [Total Consumption]
            )
    ),
    [DiffTotal]
)
 
 




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.






View solution in original post

5 REPLIES 5
PaulDBrown
Community Champion
Community Champion

It's hard to see without sample data, but you could try the following:

 

Water Consumption Difference Totals =
SUMX (
    ADDCOLUMNS (
        SUMMARIZE (
            uvw_tcUtilityReading,
            uvw_tcUtilityReading[AccountName],
            uvw_tcUtilityReading[UtilityEndDate],
            uvw_tcUtilityReading[UoM]
        ),
        "DiffTotal",
            IF (
                ISBLANK (
                    CALCULATE (
                        [Total Consumption],
                        PARALLELPERIOD ( uvw_tcUtilityReading[UtilityEndDate], -1, MONTH )
                    )
                ),
                BLANK (),
                CALCULATE (
                    [Total Consumption],
                    PARALLELPERIOD ( uvw_tcUtilityReading[UtilityEndDate], -1, MONTH )
                ) - [Total Consumption]
            )
    ),
    [DiffTotal]
)
 
 




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.






That worked to perfection! Thank you so much, this was driving me up the wall and now I can finally put it to rest!

Glad it worked. Just a quick Recommendation: for Time Intelligence functions (PARALLELPERIOD etc) you should be using a Date Table as a dimension table, or you might find unexpected results. 





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.






So just create a date table, connect them, and then update the formula above to be as shown below? 

borelza2106_0-1631214291324.png

 

borelza2106_2-1631214563545.png

 

 

 

Exactly! Just make sure the field in the matrix is the Date [Date] field instead of the field from the main table

(The date table should contain continuous dates covering the range of dates in the model)

Edit: once you've created the date table, mark it as such using the option in the ribbon





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.






Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!

December 2025 Power BI Update Carousel

Power BI Monthly Update - December 2025

Check out the December 2025 Power BI Holiday Recap!

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.