Forum Discussion
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:
The Formula I have in the CombineDates field is currently:
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.
4 Replies
- ColinANew Member
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.
- v-chenwuz-msftCommunity Support
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.
- ColinANew Member
Ideally the new column would retain only the latest 5 dates per ID, and would order them before concatenating them with a delimiter.