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

Enhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.

Reply
ColinA
New Member

Sort within Combined Date Field

I am building a visual for a user that wants to see the last 5 times an update has been submitted.  So I have an ID field that will have multiple dates associated with each ID.  I can get the dates combined into a single cell, but they are out of order.

Here is a view of the data:

ColinA_0-1647284722916.png

The Formula I have in the CombineDates field is currently:

CombineDates = CALCULATE(CONCATENATEX('Table','Table'[Date]," "),ALLEXCEPT('Table','Table'[ID]))
Is there a better way to return this so that I get the last 5 dates present for each ID?
1 ACCEPTED SOLUTION

Hi @ColinA ,

 

First, we figurt out that we need CONCATENATEX() function to combine all the date, so the problem is how to get the last 5 date. TopN() to get the result.

So DAX expression like the following:

 

expected result =
VAR _top =
    TOPN ( 5, FILTER ( 'table', [ID] = EARLIER ( 'table'[ID] ) ), [date], DESC )
RETURN
    CONCATENATEX ( _top, [date], " " )

 

Modify this measure to suit your model.

 

Best Regards

Community Support Team _ chenwu zhu

 

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

4 REPLIES 4
ColinA
New Member

Ideally the new column would retain only the latest 5 dates per ID, and would order them before concatenating them with a delimiter.

ColinA_0-1647346680983.png

 

PijushRoy
Super User
Super User

@ColinA 
What is your expected result? Share screenshot




Did I answer your question? Mark my post as a solution!
Appreciate your Like/Kudos

Proud to be a Super User!





Sorry, posted this in the wrong location.  Ideally the new column would retain only the latest 5 dates per ID, and would order them before concatenating them with a delimiter.

ColinA_0-1647367299234.png

 

Hi @ColinA ,

 

First, we figurt out that we need CONCATENATEX() function to combine all the date, so the problem is how to get the last 5 date. TopN() to get the result.

So DAX expression like the following:

 

expected result =
VAR _top =
    TOPN ( 5, FILTER ( 'table', [ID] = EARLIER ( 'table'[ID] ) ), [date], DESC )
RETURN
    CONCATENATEX ( _top, [date], " " )

 

Modify this measure to suit your model.

 

Best Regards

Community Support Team _ chenwu zhu

 

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

Helpful resources

Announcements
July 2025 community update carousel

Fabric Community Update - July 2025

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

July PBI25 Carousel

Power BI Monthly Update - July 2025

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