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
Anonymous
Not applicable

How to get max ID based on date slicer selection?

Hi, I have the below table. What I want to do is view the latest StatusID for a TicketID based on the MAX(StatusSet).

The table is controlled by a month slicer. I need to see what the latest StatusID was on the first day of each month, so for example if "July" was selected, then the example below would give me


     TicketID          LatestStatus
      55666                    4

If August was selected then the status would be 3, and so on..

What would be the best way to achieve this?

JD09631_0-1630673521148.png

 

1 ACCEPTED SOLUTION
ryan_mayu
Super User
Super User

@Anonymous 

you can create a measure

Measure = 
VAR _date=EOMONTH(min('date'[Date]),-1)
VAR _date2=maxx(FILTER(all('Table'),'Table'[TicketID]=max('Table'[TicketID])&&'Table'[StatusSet]<=_date),'Table'[StatusSet])
return maxx(FILTER(all('Table'),'Table'[TicketID]=max('Table'[TicketID])&&'Table'[StatusSet]=_date2),'Table'[TicketStatusID])

pls see the attachment below





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

Proud to be a Super User!




View solution in original post

1 REPLY 1
ryan_mayu
Super User
Super User

@Anonymous 

you can create a measure

Measure = 
VAR _date=EOMONTH(min('date'[Date]),-1)
VAR _date2=maxx(FILTER(all('Table'),'Table'[TicketID]=max('Table'[TicketID])&&'Table'[StatusSet]<=_date),'Table'[StatusSet])
return maxx(FILTER(all('Table'),'Table'[TicketID]=max('Table'[TicketID])&&'Table'[StatusSet]=_date2),'Table'[TicketStatusID])

pls see the attachment below





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

Proud to be a Super User!




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.