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

We've captured the moments from FabCon & SQLCon that everyone is talking about, and we are bringing them to the community, live and on-demand. Starts on April 14th. Register now

Reply
Anonymous
Not applicable

Last date Selection

Hi, 

 

I have the below dataset.  

SiteDate CompletedDaysLastClean
0.39.09.4 - Room2/13/2020 21:551
0.39.09.4 - Room2/18/2020 22:045
0.39.09.4 - Room2/21/2020 22:083
1-31-62 -  W/R2/14/2020 18:414
1-31-62 -  W/R2/18/2020 19:504
1-31-62 -  W/R2/19/2020 19:561
1-31-62 -  W/R2/20/2020 17:261
1-31-62 -  W/R2/21/2020 18:421
1-31-69 - PTW/R2/11/2020 20:371
1-31-69 - PTW/R2/14/2020 18:163
1-31-69 - PTW/R2/18/2020 19:454
1-31-69 - PTW/R2/19/2020 16:461
1-31-69 - PTW/R2/20/2020 16:351
1-31-69 - PTW/R2/21/2020 16:551

 

The column "DaysLastClean" is a calculated columns 

DaysLastClean =
VAR temp =
TOPN (1,FILTER (Routine,Routine[Site] = EARLIER ( Routine[Site] )
&& Routine[Date Completed] < EARLIER ( Routine[Date Completed] )
&& Routine[Status] = "Complete"
),Routine[Date Completed], DESC)
RETURN
DATEDIFF ( MINX ( temp, Routine[Date Completed]), Routine[Date Completed], DAY )
 
Quetsion= What I need to show is rows for the latest date only.
End result of the above table
 
SiteDate CompletedDaysLastClean
0.39.09.4 - Room2/21/2020 22:083
1-31-62 -  W/R2/21/2020 18:421
1-31-69 - PTW/R2/21/2020 16:551

 

Appreciate all help for a Measure or column to achieve the above result.

1 ACCEPTED SOLUTION
amitchandak
Super User
Super User

Refer

Measure = 
VAR __id = MAX ( 'Table'[Site] )
VAR __date = CALCULATE ( MAX( 'Table'[Date Completed] ), ALLSELECTED ( 'Table' ),  'Table'[Site] = __id ) 
RETURN CALCULATE ( max ( 'Table'[DaysLastClean] ), VALUES ( 'Table'[Site] ), 'Table'[Site] = __id, 'Table'[Date Completed] = __date )

 

Appreciate your Kudos.

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

View solution in original post

3 REPLIES 3
Greg_Deckler
Community Champion
Community Champion

I think you just need a table visualization with Site in it and Date set to an aggregation of Last and then your DaysLastClean?



Follow on LinkedIn
@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
DAX For Humans

DAX is easy, CALCULATE makes DAX hard...
amitchandak
Super User
Super User

Refer

Measure = 
VAR __id = MAX ( 'Table'[Site] )
VAR __date = CALCULATE ( MAX( 'Table'[Date Completed] ), ALLSELECTED ( 'Table' ),  'Table'[Site] = __id ) 
RETURN CALCULATE ( max ( 'Table'[DaysLastClean] ), VALUES ( 'Table'[Site] ), 'Table'[Site] = __id, 'Table'[Date Completed] = __date )

 

Appreciate your Kudos.

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube
Anonymous
Not applicable

@amitchandak - Thanks for the measure. The solution works perfectly.

Helpful resources

Announcements
New to Fabric survey Carousel

New to Fabric Survey

If you have recently started exploring Fabric, we'd love to hear how it's going. Your feedback can help with product improvements.

Power BI DataViz World Championships carousel

Power BI DataViz World Championships - June 2026

A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.

Join our Fabric User Panel

Join our Fabric User Panel

Share feedback directly with Fabric product managers, participate in targeted research studies and influence the Fabric roadmap.

March Power BI Update Carousel

Power BI Community Update - March 2026

Check out the March 2026 Power BI update to learn about new features.