cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
NightSky
New Member

Get the max value from Group

I have created measure like that to get MAX Value From Summarized Colum

 

NightSky_0-1635074627023.png

 

The Problem is that when I try to display result of this measure in Matrix Visualization error shows up:

 

NightSky_1-1635074716586.pngNightSky_2-1635074734067.png

 

Does anyone have any idea how can I fix it to display max value from summarized table in matrix vizualization ?

 

1 ACCEPTED SOLUTION
mahoneypat
Super User
Super User

You need to use ADDCOLUMNS(SUMMARIZE(... instead of SUMMARIZECOLUMNS(...

 

Max Value =
VAR SummarizedTable =
    ADDCOLUMNS (
        SUMMARIZE (
            'Level 1 Metrics',
            'Level 1 Metrics'[Type],
            'Level 1 Metrics'[Metric Name],
            'Level 1 Metrics'[Date]
        ),
        "Total Value"CALCULATE ( SUM ( 'Level 1 Metrics'[Value] ) )
    )
RETURN
    IF (
        ISFILTERED ( 'Level 1 Metrics'[Commercial Area] ),
        MAX ( 'Level 1 Metrics'[Value] ),
        MAXX ( SummarizedTable, [Total Value] )
    )

 

Pat

 





Did I answer your question? Mark my post as a solution! Kudos are also appreciated!

To learn more about Power BI, follow me on Twitter or subscribe on YouTube.


@mahoneypa HoosierBI on YouTube


View solution in original post

3 REPLIES 3
mahoneypat
Super User
Super User

You need to use ADDCOLUMNS(SUMMARIZE(... instead of SUMMARIZECOLUMNS(...

 

Max Value =
VAR SummarizedTable =
    ADDCOLUMNS (
        SUMMARIZE (
            'Level 1 Metrics',
            'Level 1 Metrics'[Type],
            'Level 1 Metrics'[Metric Name],
            'Level 1 Metrics'[Date]
        ),
        "Total Value"CALCULATE ( SUM ( 'Level 1 Metrics'[Value] ) )
    )
RETURN
    IF (
        ISFILTERED ( 'Level 1 Metrics'[Commercial Area] ),
        MAX ( 'Level 1 Metrics'[Value] ),
        MAXX ( SummarizedTable, [Total Value] )
    )

 

Pat

 





Did I answer your question? Mark my post as a solution! Kudos are also appreciated!

To learn more about Power BI, follow me on Twitter or subscribe on YouTube.


@mahoneypa HoosierBI on YouTube


View solution in original post

It worked out thx ! But I still don't remember why I should do it that way

Jos_Woolley
Solution Supplier
Solution Supplier

Hi,

"SUMMARIZECOLUMNS does not support evaluation within a context transition"(https://dax.guide/summarizecolumns/).
Perhaps post some data together with expected results so that we can look for workarounds.

Regards

Helpful resources

Announcements
2022 Release Wave 1 760x460.png

2022 Release Wave 1 Plan

Power Platform release plan for the 2022 release wave 1 describes all new features releasing from April 2022 through September 2022.

Power BI December 2021 Update_carousel 768x460.jpg

Check it Out!

Click here to read more about the December 2021 Updates!

Jan 2022 Dev Camp 768x460 copy.png

Power BI Dev Camp- January 27th, 2022

Mark your calendars and join us for our next Power BI Dev Camp!

Top Solution Authors