Forum Discussion

AlanP514's avatar
AlanP514
Post Patron
3 years ago
Solved

Dynamic Current date in pivot table

Hai all, Please help and Guide me to achieve this logic,

I want to return one pivot table it should dynamically show the current date first and previous days.


I applied the date field in the column layer at the pivot table visual and I tried using ascending and descending also, but the latest date does not start at the first 
the expected output is down:

10/3/2022 10/2/2022 10/1/2022 30/9/2022 29/9/2022 28/9/2022 27/9/2022



  • Hi AlanP514 ,

     

    I would add a column to your date table and use that to sort the date field. Something like

    ReverseSort = DATEDIFF([Date],TODAY(), DAY)

    then sort by column

     

    Now when you add the date to the matrix it should be sorted how you want.

     

     

5 Replies

  • AntonioM's avatar
    AntonioM
    Solution Sage

    Hi AlanP514 ,

     

    I would add a column to your date table and use that to sort the date field. Something like

    ReverseSort = DATEDIFF([Date],TODAY(), DAY)

    then sort by column

     

    Now when you add the date to the matrix it should be sorted how you want.

     

     

    • AlanP514's avatar
      AlanP514
      Post Patron

      Hi AntonioM ,
      When i am trying to sorting , i am getting error like this, Please support me 



      Dim calendar dax above

      Data model above

       

      • AntonioM's avatar
        AntonioM
        Solution Sage

        Hi AlanP514 ,

         

        Please try adding the column definition into your ADDCOLUMNS in Dim_Calendar.