Forum Discussion

common763's avatar
common763
Helper III
1 year ago
Solved

Special Date Filter Sort Inquiry

I have a date filter in my power bi report.  The end-user wants it to display all dates, but only show data for one at a time due to the model.  The data refreshes daily so I cannot select most recent date.  I did the following which works.

 

DateSlicer = if('TABLE'[DATE]='TABLE'[Max_Date],"1-Most Recent Date", 'TABLE'[DATE] & "")
 
This actually works.  I then take this new column and drop into the slicer.  The problem is when it converts to text.  We have a new text for Most Recent Date and then actual dates converted to text.  When I sort the slicer, Most recent date goes to the bottom of the slicer and the dates dont sort properly anyway.  Is there an easy way to have the end user have most recent date auto-selected with each refresh and sorted at top?  Bascially how do I use the above formula, then have it sort properly.  Any help much appreciated.  Thanks. 

 

 

3 Replies

  • instead of "1-" use " "  (a single space).  If Power BI gets cute and trims that, use any other character that comes before "1".

     

    You would also want to format your dates in sortable way, like "YYYY-MM-DD".

    • common763's avatar
      common763
      Helper III

      THe first part fixes the sort but now I have two different variant types in the column.  1 is the 0-Most Recent which will automatically have the slicer adjusted to the recent day on refresh.  Then the dates are all text.  I cannot convert them in this column.  I just want an easy way for the data to refresh and have the slicer single select the most recent date on daily refresh.  The only way I saw this done was to give it a name like 0-Most Recent but now it is causing other issues.