Forum Discussion

campelliann's avatar
campelliann
Icon for Post Patron rankPost Patron
3 years ago

Slicer with duplicate values after sort by column

Hi there,

 

So I want to sort colum yearmonth by date. The thing is that yearmonth has duplicate values, so I need to temporarily concatenate the date to this column to get distinct values allowing the sort (example 2023-01-01-12-2023). After the sort is allowed I remove the concatenated date. 

The thing is that the slicers that are based on yearmonth get duplicate values, for instance 2023-01 appears 30 times or so. 

How to work around this without the need of creating a new sort table?

Many thanks!

 

 

 

 

 

 

6 Replies

  • Arul's avatar
    Arul
    Icon for Super User rankSuper User

    campelliann ,

    Most of the time it might happen due to some additional spaces in one of the source column. Can you check the source column and perform trim & clean in Power Query Editor?

    Thanks,

    Arul

    • campelliann's avatar
      campelliann
      Icon for Post Patron rankPost Patron

      Arul Hi mate. I did, it's not it as the duplicates (for the same column) disappear if I sort by its own column. This is really from the sort. Perhaps my only solution is to create a year month/index table...

      • visheshjain's avatar
        visheshjain
        Icon for Impactful Individual rankImpactful Individual

        Hi campelliann,

         

        Please can you tell me, why do you want the YearMonth column sorted by date?

         

        All the dates of any month will have the same year month and in order to sort by another column, every value in your year month column, should correspond to a single value only.

         

        I think you need a YearMonthKey column and sort the Year Month by this key column.

        Not sure why you are getting multiple year month values in your slicer though.

         

        What am I missing here?

         

        Thank you,

        Vishesh Jain