Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Don't miss out! 2025 Microsoft Fabric Community Conference, March 31 - April 2, Las Vegas, Nevada. Use code MSCUST for a $150 discount. Prices go up February 11th. Register now.

Reply
HeatherBisher
Frequent Visitor

Dax statement to display data in one column based on most recent entry or max date

I am trying to write a Dax for a New Measure to display or filter the most recent entry for a Class (this is entered many times) and the Current class Number ( again entered many times and can change) but needing the most recent number.

Here is a look at My Data 

HeatherBisher_0-1677101452163.png

as you can see I may have a class (115-23) with the Current # of agents entered several times I need to display only the most recent number of agents for each class Number. 

I have this but it only gets part of the way I cant get past the if Statement if the expression is true.. 

Is most recent =

var CurrentClassNumber= 'Form Data'[Class Number ]

var mostRecentDate = CALCULATE(MAX('Form Data'[Entry Date]),ALL('Form Data'),'Form Data'[Class Number ] = CurrentClassNumber)

return

IF('Form Data'[Entry Date] = mostRecentDate,"","0")

 

Any help would be great I am a relitivly new user comeing from Excel and hitting road blocks.

1 ACCEPTED SOLUTION
v-rzhou-msft
Community Support
Community Support

Hi @HeatherBisher ,

 

According to your statement, I think your requirement is to show data on most recent date each class number. Here I suggest you to filter your visual by measure in visual level filter.

Is most recent = 
VAR CurrentClassNumber =
    MAX ( 'Form Data'[Class Number] )
VAR mostRecentDate =
    CALCULATE (
        MAX ( 'Form Data'[Entry Date] ),
        ALL ( 'Form Data' ),
        'Form Data'[Class Number] = CurrentClassNumber
    )
RETURN
    IF ( MAX ( 'Form Data'[Entry Date] ) = mostRecentDate, 1, 0 )

Add this measure into visual level filter and set it to show items when value = 1.

RicoZhou_0-1677566557274.png

 

Best Regards,
Rico Zhou

 

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

1 REPLY 1
v-rzhou-msft
Community Support
Community Support

Hi @HeatherBisher ,

 

According to your statement, I think your requirement is to show data on most recent date each class number. Here I suggest you to filter your visual by measure in visual level filter.

Is most recent = 
VAR CurrentClassNumber =
    MAX ( 'Form Data'[Class Number] )
VAR mostRecentDate =
    CALCULATE (
        MAX ( 'Form Data'[Entry Date] ),
        ALL ( 'Form Data' ),
        'Form Data'[Class Number] = CurrentClassNumber
    )
RETURN
    IF ( MAX ( 'Form Data'[Entry Date] ) = mostRecentDate, 1, 0 )

Add this measure into visual level filter and set it to show items when value = 1.

RicoZhou_0-1677566557274.png

 

Best Regards,
Rico Zhou

 

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Helpful resources

Announcements
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!

December 2024

A Year in Review - December 2024

Find out what content was popular in the Fabric community during 2024.