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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
PshemekFLK
Helper IV
Helper IV

Can't get to the right MAX

I have this table:

 

PshemekFLK_0-1666884141516.png

And would like to achieve a simple MAX column:

 

PshemekFLK_0-1666884624397.png

 

 

I'm trying this measure but it doesn't work:

 

MAXX(ALL(dim_calendar[Activity Mo Name]), [Ratio])

 

Can you guide me towards the right solution?

 

 

 

 

 

1 ACCEPTED SOLUTION
besomebody20
Resolver I
Resolver I

Please try this measure:

CALCULATE(
MAXX(
ADDCOLUMNS(
SUMMARIZE(
'dim_calendar',
'dim_calendar'[Activity Mo Name]
),
"_ratio", [Ratio]
),
[_ratio]
),
ALLSELECTED('dim_calendar')
)

 The ADDCOLUMNS and SUMMARIZE functions create the table for MAXX to iterate over to find the max ratio. The ALLSELECTED function will clear the filter context on the row of the table visual to give you the max ratio of all rows.

View solution in original post

13 REPLIES 13
besomebody20
Resolver I
Resolver I

Please try this measure:

CALCULATE(
MAXX(
ADDCOLUMNS(
SUMMARIZE(
'dim_calendar',
'dim_calendar'[Activity Mo Name]
),
"_ratio", [Ratio]
),
[_ratio]
),
ALLSELECTED('dim_calendar')
)

 The ADDCOLUMNS and SUMMARIZE functions create the table for MAXX to iterate over to find the max ratio. The ALLSELECTED function will clear the filter context on the row of the table visual to give you the max ratio of all rows.

@besomebody20 , Thank you so much for this! Works perfectly! I was pulling my hair out the whole day over this!

 

eliasayy
Impactful Individual
Impactful Individual

Hello can you please try:

 

 

MAXX(ALL(Dim_calendar), [ratio])

 

 


dim date:
 

dimdate.png

created sample of your data: 

 

Screenshot 2022-10-28 000821.png

result:

Screenshot 2022-10-28 000829.png

 

 

 

 

tamerj1
Super User
Super User

@PshemekFLK 

Please try

=
MAXX (
    CALCULATETABLE (
        VALUES ( dim_calendar[Activity Mo Name] ),
        REMOVEFILTERS ( dim_calendar )
    ),
    [Ratio]
)

@tamerj1  Also didn't work. Exact same result as last time... 

@PshemekFLK 

I'm sure we don't have to complete picture. Please try

=
MAXX ( KEEPFILTERS ( ALL ( dim_calendar[Activity Mo Name] ) ), [Ratio] )

@tamerj1  again same result...

 

I also thought there must be something else blocking but just checked for a thrid time:

 

no filters applied to the table

[Ratio] = DIVIDE([Measure 1],[Measure 2])

[Measure 1] = DIVIDE(SUM(fct_bookings[Column 1]),1000)

[Measure 2] = DIVIDE(SUM(fct_bookings[Column 2]),1000)

dim_calendar is properly connected to fct_bookings with "one to many" relation

 

What else can be stopping the MAXX measure from working properly?

@PshemekFLK 

Perhaps you are using the wrong column in the visual. Perhaps other columns are also present in the same visual 

@tamerj1 Checked all the above. Only dim_calendar{Activity Mo Name], [Ratio] and [Max} in the table...

tamerj1
Super User
Super User

Hi @PshemekFLK 

what result are getting? Are you filtering a certain year?

Greg_Deckler
Super User
Super User

@PshemekFLK If Ratio is a measure, maybe: 

Max Measure =
  VAR __Table = ADDCOLUMNS(DISTINCT(ALL(dim_calendar[Activity Mo Name])),"__Ratio",[Ratio])
RETURN
  MAXX(__Table, [__Ratio])

@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
The Definitive Guide to Power Query (M)

DAX is easy, CALCULATE makes DAX hard...

@Greg_Deckler

Unfortunately doesn't work. I'm getting same result with yours and mine formula which is just replication of Ratio column. It's like I can't remove the filter from "Activity Mo Name" no matter what I try.

 

@tamerj1 , @Greg_Deckler   the result:

 

PshemekFLK_0-1666897573019.png

 

 

 

 

@tamerj1 I'm not filtering on a year, no filters on that table

 

[Ratio] measure is a simple divide or SUMX over fact tables. I really don't get why it doesn't work

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

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

Top Solution Authors