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

Join the Fabric FabCon Global Hackathon—running virtually through Nov 3. Open to all skill levels. $10,000 in prizes! Register now.

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
FabCon Global Hackathon Carousel

FabCon Global Hackathon

Join the Fabric FabCon Global Hackathon—running virtually through Nov 3. Open to all skill levels. $10,000 in prizes!

September Power BI Update Carousel

Power BI Monthly Update - September 2025

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

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.

Top Solution Authors
Top Kudoed Authors