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
alfranco17
Advocate I
Advocate I

Summarize of a summarize

Hi.

I am struggling with this formula. A user can have several evaluations during a year. So I need to calculate the monthly average, and then average those monthly averages.


I am trying to summarize another summarize, but I can't get to the "MonthlyAverage" that contains the average for each month.

Any tips on how to fix it? They will be greatly appreciated.

 

Thanks.

Armando

SUMMARIZE(
    SUMMARIZE (
        'PositionEvaluationPeriod',
        Calendar[Date],        
        Users[idUser],
        "MonthlyAverage", AVERAGE ( Evaluation[Grade] )
    ),
    Users[idUser],
    "GeneralAverage", AVERAGE(MonthlyAverage)
)

 

1 ACCEPTED SOLUTION
edhans
Super User
Super User

Try this. 

Test =
SUMMARIZE(
    SUMMARIZE(
        'PositionEvaluationPeriod',
        Calendar[Date],
        Users[idUser],
        "MonthlyAverage", AVERAGE( Evaluation[Grade] )
    ),
    Users[idUser],
    "GeneralAverage", AVERAGE( [MonthlyAverage] )
)

The syntax is correct, but do not think it will work. You will probably need this:

Test =
VAR varFirstSummary =
    SUMMARIZE(
        'PositionEvaluationPeriod',
        Calendar[Date],
        Users[idUser],
        "MonthlyAverage", AVERAGE( Evaluation[Grade] )
    )
RETURN
    SUMMARIZE(
        varFirstSummary,
        Users[idUser],
        "GeneralAverage",
            AVERAGEX(
                varFirstSummary,
                [MonthlyAverage]
            )
    )

And you may still need to wrap AverageX in a CALCULATE, and you might still get wrong results. SUMMARIZE should generally only be used to create the summary fields. Use ADDCOLUMNS() to add the values.

Test =
VAR varFirstSummary =
    ADDCOLUMNS(
        SUMMARIZE(
            'PositionEvaluationPeriod',
            Calendar[Date],
            Users[idUser]
        ),
        "MonthlyAverage",
            CALCULATE(
                AVERAGE( Evaluation[Grade] )
            )
    )
RETURN
    ADDCOLUMNS(
        SUMMARIZE(
            varFirstSummary,
            Users[idUser]
        ),
        "GeneralAverage",
            CALCULATE(
                AVERAGEX(
                    varFirstSummary,
                    [MonthlyAverage]
                )
            )
    )

See Best Practices Using SUMMARIZE and ADDCOLUMNS - SQLBI for more info on this. SUMMARIZE() is a bit buggy in some cases is the reason for this.



Did I answer your question? Mark my post as a solution!
Did my answers help arrive at a solution? Give it a kudos by clicking the Thumbs Up!

DAX is for Analysis. Power Query is for Data Modeling


Proud to be a Super User!

MCSA: BI Reporting

View solution in original post

3 REPLIES 3
edhans
Super User
Super User

Glad to help @alfranco17 



Did I answer your question? Mark my post as a solution!
Did my answers help arrive at a solution? Give it a kudos by clicking the Thumbs Up!

DAX is for Analysis. Power Query is for Data Modeling


Proud to be a Super User!

MCSA: BI Reporting
alfranco17
Advocate I
Advocate I

Thank you!

edhans
Super User
Super User

Try this. 

Test =
SUMMARIZE(
    SUMMARIZE(
        'PositionEvaluationPeriod',
        Calendar[Date],
        Users[idUser],
        "MonthlyAverage", AVERAGE( Evaluation[Grade] )
    ),
    Users[idUser],
    "GeneralAverage", AVERAGE( [MonthlyAverage] )
)

The syntax is correct, but do not think it will work. You will probably need this:

Test =
VAR varFirstSummary =
    SUMMARIZE(
        'PositionEvaluationPeriod',
        Calendar[Date],
        Users[idUser],
        "MonthlyAverage", AVERAGE( Evaluation[Grade] )
    )
RETURN
    SUMMARIZE(
        varFirstSummary,
        Users[idUser],
        "GeneralAverage",
            AVERAGEX(
                varFirstSummary,
                [MonthlyAverage]
            )
    )

And you may still need to wrap AverageX in a CALCULATE, and you might still get wrong results. SUMMARIZE should generally only be used to create the summary fields. Use ADDCOLUMNS() to add the values.

Test =
VAR varFirstSummary =
    ADDCOLUMNS(
        SUMMARIZE(
            'PositionEvaluationPeriod',
            Calendar[Date],
            Users[idUser]
        ),
        "MonthlyAverage",
            CALCULATE(
                AVERAGE( Evaluation[Grade] )
            )
    )
RETURN
    ADDCOLUMNS(
        SUMMARIZE(
            varFirstSummary,
            Users[idUser]
        ),
        "GeneralAverage",
            CALCULATE(
                AVERAGEX(
                    varFirstSummary,
                    [MonthlyAverage]
                )
            )
    )

See Best Practices Using SUMMARIZE and ADDCOLUMNS - SQLBI for more info on this. SUMMARIZE() is a bit buggy in some cases is the reason for this.



Did I answer your question? Mark my post as a solution!
Did my answers help arrive at a solution? Give it a kudos by clicking the Thumbs Up!

DAX is for Analysis. Power Query is for Data Modeling


Proud to be a Super User!

MCSA: BI Reporting

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!

November Power BI Update Carousel

Power BI Monthly Update - November 2025

Check out the November 2025 Power BI update to learn about new features.

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.