Forum Discussion

borelza2106's avatar
borelza2106
Frequent Visitor
4 years ago
Solved

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 wr...
  • PaulDBrown's avatar
    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]
    )