Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Don't miss out! 2025 Microsoft Fabric Community Conference, March 31 - April 2, Las Vegas, Nevada. Use code MSCUST for a $150 discount. Prices go up February 11th. Register now.

Reply
Anonymous
Not applicable

Totals Question Pls

Hi all, I have this table.

Actual, Calc and Max are measures. Max is the value that is greater between Actual and Calc

Max rows are correct but the total is not. I was able to use "Isfilter" to get the correct condition under the "test" column but cant get to correctly total the max column. Any suggestions would be greatly appreciated. Thanks so much!

 
 
 

  sumtotal.PNG

9 REPLIES 9
stevedep
Memorable Member
Memorable Member

stevedep
Memorable Member
Memorable Member

Hi,

Its more simple when using an interator:

 

_MaxOfColumns = MAXX('Table';IF('Table'[Actual]>'Table'[Calc];'Table'[Actual];'Table'[Calc]))

 

As seen here:

maxxxx.jpg

Please mark as solution if this is what you are looking for.

Kind regards, Steve. 

@stevedep the ask was to show the sum of the maxima, not the max of the max.

@lbendlin Thanks for the heads up. Its a small change to make it working:

_SumofMaxOfColumns = SUMX('Table';IF('Table'[Actual]>'Table'[Calc];'Table'[Actual];'Table'[Calc]))

As seen here:

sumofmax.jpg

@Anonymous , pls let us know if this is what you are looking for.

Kind regards, Steve. 

p.s. file has been updated. 

lbendlin
Super User
Super User

You haven't mentioned what you expect the total to be for the max column. Max, average, something else?

Anonymous
Not applicable

Hello, oh sorry. Sum is what I need

 

Thanks

 

This was a nice challenge.  Here's my approach - there are probably better ones.

 

Max = if(
    HASONEVALUE('Table (3)'[Prod])
    ,max(selectedvalue('Table (3)'[Actual]),SELECTEDVALUE('Table (3)'[Calc]))
    ,sumx(Filter('Table (3)','Table (3)'[Actual]>'Table (3)'[Calc]),'Table (3)'[Actual])
    +sumx(Filter('Table (3)','Table (3)'[Actual]<='Table (3)'[Calc]),'Table (3)'[Calc])
    )

 

So if you look at the rows, just use the regular max() logic, but for the totals distinguish between the cases where the actual is bigger than the calc, and where the actual is smaller or equal.  The sum of these two scenarios gives the desired result.

 

Note: Additional filters may need to be applied depending on your data model. 

Anonymous
Not applicable

Thanks very much for the help.

 

After modifying your equation a little I was able to make it work

 

Here is the final eq

 

if(ISFILTERED(Table1[Prod]),sumx(Table1,[max]),CALCULATE(SUMX(Table1,[max]),ALL(Table1[Prod])))
 
More importantly, I understand the concept better now. Thanks very much!
 
 

Helpful resources

Announcements
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount! Prices go up Feb. 11th.

Jan25PBI_Carousel

Power BI Monthly Update - January 2025

Check out the January 2025 Power BI update to learn about new features in Reporting, Modeling, and Data Connectivity.

Jan NL Carousel

Fabric Community Update - January 2025

Find out what's new and trending in the Fabric community.