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
dk6569
Helper I
Helper I

Return Max Date based on column filter

I'm in need of some dax help. I have a table that contains 2 columns; Date & Event. I only want to see the date that is associated with a specific event. For example in the table below I only want to see the dates with the event that begin with "FM". 

 

DateEvent
7/12/2021FM Party
1/5/2020Corporate Event
5/6/2021FM Event
1/1/2022Event FM
2/5/2020Business FM
6/6/2021FM Meeting

 

Thank you for any assistance

1 ACCEPTED SOLUTION

Hi @dk6569 

 

If you can mark the first one as a solution just so that others can use it given your original post, that will allow better solution identification down the track. However, to get you the additional caveat item, you can use below:

 

Measure = 

VAR _1 = CALCULATE
( MAX ( TableTest[Column1] ) , LEFT ( TableTest[Column1] , 2 ) = "FM" )
RETURN
IF ( LEFT ( TableTest[Column1] , 2 ) <> "FM" , BLANK() , _1 )

 Hope this helps!

Theo

If I have posted a response that resolves your question, please accept it as a solution to formally close the post.

Also, if you are as passionate about Power BI, DAX and data as I am, please feel free to reach out if you have any questions, queries, or if you simply want to connect and talk to another data geek!

Want to connect?www.linkedin.com/in/theoconias

View solution in original post

3 REPLIES 3
TheoC
Super User
Super User

Hi @dk6569 

 

You can create a measure with the logic such as the following:

 

Measure = CALCULATE ( MAX ( TableTest[Column1] ) , LEFT ( TableTest[Column1] , 2 ) = "FM" )
 Adjust Column1 to 'TableName'[Event] and should be all good from there.
 

TheoC_0-1644273144631.png

Hope this helps!

Theo

 

If I have posted a response that resolves your question, please accept it as a solution to formally close the post.

Also, if you are as passionate about Power BI, DAX and data as I am, please feel free to reach out if you have any questions, queries, or if you simply want to connect and talk to another data geek!

Want to connect?www.linkedin.com/in/theoconias

Thank you Theo - one more caviot, I need the other events to appear in the report as well, but they will show a blank value.

 

Thanks again for your help

 

Debbie

Hi @dk6569 

 

If you can mark the first one as a solution just so that others can use it given your original post, that will allow better solution identification down the track. However, to get you the additional caveat item, you can use below:

 

Measure = 

VAR _1 = CALCULATE
( MAX ( TableTest[Column1] ) , LEFT ( TableTest[Column1] , 2 ) = "FM" )
RETURN
IF ( LEFT ( TableTest[Column1] , 2 ) <> "FM" , BLANK() , _1 )

 Hope this helps!

Theo

If I have posted a response that resolves your question, please accept it as a solution to formally close the post.

Also, if you are as passionate about Power BI, DAX and data as I am, please feel free to reach out if you have any questions, queries, or if you simply want to connect and talk to another data geek!

Want to connect?www.linkedin.com/in/theoconias

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.