Sort by number in a grouped text field

  • Sort by number in a grouped text field

    Posted by DSC Communities on October 24, 2022 at 8:50 pm
    • EMMY ALAMI

      Member

      October 24, 2022 at 8:50 PM

      Dear Power Bi Community,

      I have an issue with the group by function where the combined values are combination of 2 fields :

      Field 1 = numbers

      Field 2 = text

      Ā 

      I’ve used the following formula to group rows :

      = Table.Group(#”customized column”, {“FactorA”, “FactorB”}, {{“Combined value”, each Text.Combine((List.Sort( [Field1 & Field2], Order.Ascending),”#(lf)”), type nullable text}})

      Ā 

      with this formula, rows into each combined value is sorted but as following :

      1 xxxx

      10 xxxx

      2 xxxx

      while I’m looking for an order as :

      1 xxxx

      2 xxxx

      10 xxxx

      Any ideas to help with are more than welcome !

      Many thanks in advance for your help ! Ā 

      Regards,

      ——————————
      EMMY ALAMI
      Data analyst
      ——————————

    • Sharavan Kumar

      Member

      October 25, 2022 at 12:21 AM

      Check the data format of that number column 

      ——————————————-

    • EMMY ALAMI

      Member

      October 25, 2022 at 5:03 AM

      HI,
      It’s a number bit once mergerd with the etxt format it’s a text
      Thanks for your reply !

      ——————————
      EMMY ALAMI
      Data analyst
      ——————————
      ——————————————-

    • Fredy Chen

      Member

      October 25, 2022 at 5:51 AM

      Can you sort before the combine?

      ——————————
      Fredy Chen
      ——————————
      ——————————————-

    • Amon Seagull

      Member

      October 26, 2022 at 9:38 AM

      If you like this approach (which I do, if it fits your problem), take care that sorting is not guaranteed to work if you don’t apply a buffer step. Imke Feldman raised that here:

      https://community.powerbi.com/t5/Community-Blog/Bug-warning-for-Table-Sort-and-removing-duplicates-in-Power/ba-p/810390

      She also has a link to her dialogue with MS on it.

      ——————————
      Amon Seagull
      McKinney
      ——————————
      ——————————————-

    • Sharavan Kumar

      Member

      October 25, 2022 at 6:04 AM

      The try to convert fixed text 001, 002…

      ——————————————-

    • Nancy Peterson

      Member

      October 25, 2022 at 5:17 PM

      If you still have the number column in your table, you can use it to sort. Go to the data view and select the text column you want to sort. Select the Column Tools menu and click on the button for “Sort by Column”. Select your number column and now this new text field will be sorted by the number column.

      ——————————
      Nancy Peterson
      Senior Business Analyst
      Pitsco Education
      Pittsburg KS
      ——————————
      ——————————————-

    • EMMY ALAMI

      Member

      October 26, 2022 at 3:54 PM

      Many thanks !Ā 
      I finally used the method of adding leading zeros for Nbres that are <9 so at the end I have a list : 01 / 02/ 03/ …. / 10 / 11/ …
      and it works šŸ™‚Ā 
      Thanks again !

      ——————————
      EMMY ALAMI
      Data analyst
      ——————————
      ——————————————-

    DSC Communities replied 3 years, 5 months ago 1 Member · 0 Replies
  • 0 Replies

Sorry, there were no replies found.

The discussion ‘Sort by number in a grouped text field’ is closed to new replies.

Start of Discussion
0 of 0 replies June 2018
Now

Welcome to our new site!

Here you will find a wealth of information created for peopleĀ  that are on a mission to redefine business models with cloud techinologies, AI, automation, low code / no code applications, data, security & more to compete in the Acceleration Economy!