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
smpa01
Super User
Super User

DAX to return max of corresponding column based on slicer selection

Hello experts,

 

My raw data is following.

 

NameDatePeriod
Jan1/1/20191
Feb2/1/20192
Mar3/1/20193
Apr4/1/20194

 

I am passing on the Name as slicer to the users of the report.

 

Capture.PNG

What I am hoping for DAX to return is the corresoponding max value of the Period when multiples values are selected from the slicer. For example,

 

when the selection is following

Capture.PNG

 

I am hoping for DAX to return following

Capture.PNG

Did I answer your question? Mark my post as a solution!
Proud to be a Super User!
My custom visualization projects
Plotting Live Sound: Viz1
Beautiful News:Viz1, Viz2, Viz3
Visual Capitalist: Working Hrs
2 ACCEPTED SOLUTIONS

I would expect in this scenario that the simple MAX( column ) would work too

Max Period = MAX('Table'[Period])

View solution in original post

Seems to work for me, see Page 4 and Table 7 in attached.


@ 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...

View solution in original post

7 REPLIES 7
Greg_Deckler
Super User
Super User

Probably something along the lines of:

 

MAXX(ALLSELECTED('Table'),[Period])


@ 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...

I would expect in this scenario that the simple MAX( column ) would work too

Max Period = MAX('Table'[Period])

Thanks a lot @d_gosbell and @Greg_Deckler 

Did I answer your question? Mark my post as a solution!
Proud to be a Super User!
My custom visualization projects
Plotting Live Sound: Viz1
Beautiful News:Viz1, Viz2, Viz3
Visual Capitalist: Working Hrs

@d_gosbelltested. It did not work. If you have a workbook where it works would be great if you can please upload/share/show.

Did I answer your question? Mark my post as a solution!
Proud to be a Super User!
My custom visualization projects
Plotting Live Sound: Viz1
Beautiful News:Viz1, Viz2, Viz3
Visual Capitalist: Working Hrs

It works for my single table model (see attached)

@Greg_Deckler  thanks for the reponse.

 

So far, I tried this. But did not get what I wanted. Since I am passing the Name to create slicer, ALLSELECTED does not see the corresponding period number in MAXX. SELECTEDVALUE does see the correponding value based on the slicer from the same table but does not allow MAXX to be applied on it.

Capture.PNG

Did I answer your question? Mark my post as a solution!
Proud to be a Super User!
My custom visualization projects
Plotting Live Sound: Viz1
Beautiful News:Viz1, Viz2, Viz3
Visual Capitalist: Working Hrs

Seems to work for me, see Page 4 and Table 7 in attached.


@ 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...

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.