cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
smpa01 Senior Member
Senior Member

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

2 ACCEPTED SOLUTIONS

Accepted Solutions
Super User
Super User

Re: DAX to return max of corresponding column based on slicer selection

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

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

View solution in original post

Super User
Super User

Re: DAX to return max of corresponding column based on slicer selection

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


I have book! Learn Power BI from Packt


Did I answer your question? Mark my post as a solution!

Proud to be a Datanaut!

View solution in original post

7 REPLIES 7
Super User
Super User

Re: DAX to return max of corresponding column based on slicer selection

Probably something along the lines of:

 

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


I have book! Learn Power BI from Packt


Did I answer your question? Mark my post as a solution!

Proud to be a Datanaut!

Highlighted
smpa01 Senior Member
Senior Member

Re: DAX to return max of corresponding column based on slicer selection

@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

Super User
Super User

Re: DAX to return max of corresponding column based on slicer selection

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

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

View solution in original post

smpa01 Senior Member
Senior Member

Re: DAX to return max of corresponding column based on slicer selection

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

Super User
Super User

Re: DAX to return max of corresponding column based on slicer selection

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


I have book! Learn Power BI from Packt


Did I answer your question? Mark my post as a solution!

Proud to be a Datanaut!

View solution in original post

Super User
Super User

Re: DAX to return max of corresponding column based on slicer selection

It works for my single table model (see attached)

smpa01 Senior Member
Senior Member

Re: DAX to return max of corresponding column based on slicer selection

Thanks a lot @d_gosbell and @Greg_Deckler 

Helpful resources

Announcements
New Topics Started Badges Coming

New Topics Started Badges Coming

We're releasing new versions of the badge that everyone's talking about. ;) Check your inbox for notifications.

MBAS 2020

Save the new date (and location)!

Our business applications community is growing—so we needed a different venue, resulting in a new date and location. See you there!

Difinity Conference

Difinity Conference

The largest Power BI, Power Platform, and Data conference in New Zealand

Top Solution Authors
Top Kudoed Authors (Last 30 Days)