Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
5 years ago
Solved

Sum based on another value

Hi Team,   I have below screenshot for my data Table and Final output expected table.       Thanks, KV's
  • Anonymous's avatar
    Anonymous
    5 years ago

    HI Anonymous,

    I'd like to suggest you add a variable to summary these records and use the iterator function(sumx) on this variable to apply second aggregations.

    Measure =
    VAR summary =
        SUMMARIZE (
            Table,
            [Month],
            "Diff",
                LOOKUPVALUE ( RawTable[Target], RawTable[VALUES], [Month] )
                    - LOOKUPVALUE ( RawTable[Target], RawTable[VALUES], "Total " & [Month] )
        )
    RETURN
        SUMX ( summary, [Diff] )

    The 'table' is a new calculate table with all month names, they are used as the category of table visual.

    Regards,

    Xiaoxin Sheng