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

The Power BI DataViz World Championships are on! With four chances to enter, you could win a spot in the LIVE Grand Finale in Las Vegas. Show off your skills.

Reply
NG1407
Frequent Visitor

Display Only those records where date is latest

I want to display data only for those student where date is latest. I dont want to show old dates associated with that student.

I want to do it in power bi /dax

PFB data:

Studentstartdateenddate
A1-jan-202210-dec-2022
A1-jan-202225-jul-2023
A1-jan-202215-jan-2025
B4-apr-202310-dec-2022
B4-apr-202311-dec-2022
B4-apr-202325-jul-2023 

Result I want

Studentstartdateenddate
A1-jan-202215-jan-2025
B4-apr-2023 25-jul-2023 
1 ACCEPTED SOLUTION
vivek31
Resolver II
Resolver II

HI @NG1407 ,

you can create this type of measure to find latest date

latest date = CALCULATE(MAX('Table (4)'[enddate]),ALLEXCEPT('Table (4)','Table (4)'[Student]))

vivek31_0-1738777160067.png

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

Thank you

 

 

View solution in original post

7 REPLIES 7
vivek31
Resolver II
Resolver II

HI @NG1407 ,

you can create this type of measure to find latest date

latest date = CALCULATE(MAX('Table (4)'[enddate]),ALLEXCEPT('Table (4)','Table (4)'[Student]))

vivek31_0-1738777160067.png

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

Thank you

 

 

You solution works well when we have same records. It doesn't work when we have different records. As shown below

NG1407_1-1739271274402.png

Result its giving...

NG1407_0-1739271232533.png

Result it should give is: Latest date records only i.e. 

StudentdateRemarks
A2/3/2023Good
B2/3/2025Good
sangeethray_92
Frequent Visitor

@NG1407 

Create a calculated column in the table to flag the first date of each student.

Last_Date_Flag =
VAR A =
CALCULATE(
MAX('Table'[EndDate]),
ALLEXCEPT('Table', 'Table'[StudentID])
)

RETURN
IF(A = 'Table'[EndDate], 1, 0)

 

Put this column to the visual level filter and filter 1. This way you will be able to show any data related to the last date for each student. 

 

Did I answer your question? Mark my post as a solution! And Kudos are appreciated

@NG1407 

 

Have you tried this?

Yes this works fine. But its affecting other Dax too.

Can you show an example? 
When visualizing how it is effecting other measures? 

May be it will get fixed if you ignore this column in other measures. Adding all with this new column in other measures. 

bhanu_gautam
Super User
Super User

@NG1407 , Go to modelling and create a new table

 

LatestRecords =
VAR LatestDates =
ADDCOLUMNS(
SUMMARIZE(
YourTable,
YourTable[Student],
"LatestEndDate", MAX(YourTable[enddate])
),
"startdate",
CALCULATE(
MAX(YourTable[startdate]),
YourTable[enddate] = [LatestEndDate]
)
)
RETURN
SELECTCOLUMNS(
LatestDates,
"Student", [Student],
"startdate", [startdate],
"enddate", [LatestEndDate]
)




Did I answer your question? Mark my post as a solution! And Kudos are appreciated

Proud to be a Super User!




LinkedIn






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!

FebPBI_Carousel

Power BI Monthly Update - February 2025

Check out the February 2025 Power BI update to learn about new features.

Feb2025 Sticker Challenge

Join our Community Sticker Challenge 2025

If you love stickers, then you will definitely want to check out our Community Sticker Challenge!

Feb2025 NL Carousel

Fabric Community Update - February 2025

Find out what's new and trending in the Fabric community.