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
paa_paa
New Member

Get value from another column using MAXX

Hi there,

 

I have a measure that (1) creates a table, and (2) returns the max value for that table. It looks something like this:

 

measure = maxx(summarize('Table1','Table1'[Area],"Sales",[Sales]),[Sales])

 

If I understand how it works correctly what this does is

 

1. Summarize creates a table such as

 

AreaSales
North988
East200
West300
South500

 

2. Maxx returns the max value for sales, that is, 988

 


What I want is a measure that returns "North" (the area with the max sales). I've been struggling a little but no luck, any help?

 

Cheers.

 

1 ACCEPTED SOLUTION

@paa_paa

 

Give this a shot as well.

[Measure] is the measure you created which gets you maximum sales

 

Region with Max Sales =
VAR maxsales = [measure]
RETURN
    CALCULATE (
        FIRSTNONBLANK ( Table1[Area], 1 ),
        FILTER ( ALL ( Table1[Area] ), [Sales] = maxsales )
    )

 


Regards
Zubair

Please try my custom visuals

View solution in original post

4 REPLIES 4
paa_paa
New Member

Thanks to both!

 

I ended up using Zabair's solution, but probably both of them work, as from what I could gather they both use the same concept (filter the table for the value)

 

 

 

Zabairs one was pretty much a copy of mine.  Not sure why he replied when I had already provided a more efficient solution that didn't require a calculate.


To learn more about DAX visit : aka.ms/practicalDAX

Proud to be a Datanaut!

Phil_Seamark
Employee
Employee

Hi @paa_paa

 

I think this measure gets close

 

Measure2 = 
VAR myGrouping = SUMMARIZECOLUMNS('Table1'[Area],"Grouped Sales",SUM('Table1'[Sales]))
VAR myMaxValue = MAXX(myGrouping,[Grouped Sales])
RETURN 
	MAXX(
		FILTER(
			myGrouping,
			[Grouped Sales] =myMaxValue) ,
			[Area]
			)

To learn more about DAX visit : aka.ms/practicalDAX

Proud to be a Datanaut!

@paa_paa

 

Give this a shot as well.

[Measure] is the measure you created which gets you maximum sales

 

Region with Max Sales =
VAR maxsales = [measure]
RETURN
    CALCULATE (
        FIRSTNONBLANK ( Table1[Area], 1 ),
        FILTER ( ALL ( Table1[Area] ), [Sales] = maxsales )
    )

 


Regards
Zubair

Please try my custom visuals

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.