Forum Discussion

Cado_one's avatar
Cado_one
Resolver III
3 years ago
Solved

Summarize a summarized table

Hi everyone,   Context : I need to display values with different aggregations in a matrix on 4 levels. - Level 1 : raw values from a source table - Level 2 : sum of the level 1 values by month fo...
  • Anonymous's avatar
    Anonymous
    3 years ago

    Hi Cado_one,

    You can try to use the following measure formulas if helps:

    Formula =
    VAR t1 =
        SUMMARIZE ( Source, [LOCATIONS], [MONTH], "SumMonths", SUM ( Source[Values] ) )
    VAR t2 =
        SUMMARIZE (
            Source,
            [LOCATIONS],
            "AverageLocations",
                AVERAGEX (
                    FILTER ( t1, [LOCATIONS] = EARLIER ( Source[LOCATIONS] ) ),
                    [SumMonths]
                )
        )
    RETURN
        IF (
            ISINSCOPE ( Dates[Month] ),
            SUM ( Source[Values] ),
            IF (
                ISINSCOPE ( Source[LOCATIONS] ),
                AVERAGEX ( t1, [SumMonths] ),
                AVERAGEX ( t2, [AverageLocations] )
            )
        )

    If the above formula also doesn't help, please share more detailed information to help us clarify your scenario to test.

    How to Get Your Question Answered Quickly 

    Regards,

    Xiaoxin Sheng