Forum Discussion
Problems WIth Total Calculating Wrong
- 4 years ago
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] )
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]
)
That worked to perfection! Thank you so much, this was driving me up the wall and now I can finally put it to rest!
- PaulDBrown4 years agoCommunity Champion
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.
- borelza21064 years agoFrequent Visitor
So just create a date table, connect them, and then update the formula above to be as shown below?
- PaulDBrown4 years agoCommunity Champion
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