cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
Helper III
Helper III

Sort Column value from biggest to lowest

Hi all,

I have tried to search for something that could give a lot of the answer to how many filter function that can rank the values ​​from largest to smallest and vice versa.

That's the value of "ha missing" I would like to have ranked

If it can be explained step by step it will be very nice!!!

I hope you can help me, please!

See the picture
-Peter

2 ACCEPTED SOLUTIONS

Accepted Solutions
Highlighted
Super User III
Super User III

Re: Sort Column value from biggest to lowest

@phh 

Power Apps, calculated columns can sometimes behave like strings, even when you define the column as numeric.

I would try Warren's suggestion. If it still doesn't sort correctly, you could try modifying it so that it calls the Value function to convert your 'Ha_x0020_mangler' calculated column to a number like so:

SortByColumns(
   AddColumns(   
      Jordprøver5,
      "HAMissing"
      Value(Ha_x0020_mangler)
   ),
   HAMissing,
   If(
      varSortAscending,
      Ascending,
      Descending
   )
)

 

View solution in original post

Highlighted
Super User III
Super User III

Re: Sort Column value from biggest to lowest

Hi Peter,

I'm glad that works. You can use AddColumns to add 'Ha Mangler' like so.

 

SortByColumns(AddColumns(Jordpr0ver5, "valHaBestilt", Value(HaBestilt), "valHaMangler", Value(HaMangler)),
              SortPriority,
              If(SortDescending,Ascending,Descending)
)

 

You can then sort that column with this formula.

UpdateContext({SortPriority:"valHaMangler",
               SortDescending:!SortDescending}
)

 

View solution in original post

28 REPLIES 28
Highlighted
Super User III
Super User III

Re: Sort Column value from biggest to lowest

Hi  Peter,

The SortByColumns can help you.

https://docs.microsoft.com/en-gb/powerapps/maker/canvas-apps/functions/function-sort 

In this case, you would amend the Items property of your gallery using the formula beneath.

SortByColumns( <InsertExistingItemsFormulaForGallery1>, 
             "ha missing", Descending  
)

 

Highlighted
Resolver II
Resolver II

Re: Sort Column value from biggest to lowest

@phh You can set you gallery items property to sort depending on a boolean variable:

 

 

SortByColumns(
   tabDaten,
   "Ha Missing",
   If(
      varSortAscending,
      Ascending,
      Descending
   )
)

 

 

 Then on the sort button OnSelect property you toggle the boolean variable:

 

 

Set(varSortAscending, !varSortAscending)

 

 

So without setting pressing the sort button the sorting should be descending upon loading at first since varSortAscending will be blank/false.

 

Highlighted
Helper III
Helper III

Re: Sort Column value from biggest to lowest

Hi @TJO,

It just turns the column around. the black not on the values.

See the pictures

Highlighted
Resolver II
Resolver II

Re: Sort Column value from biggest to lowest

@phh That is weird. Maybe there is a problem with the space in your column name (if your data is in SharePoint or Excel). Could you try with "ha_x0020_missing"

Highlighted
Helper III
Helper III

Re: Sort Column value from biggest to lowest

Hi @TJO 
No?

Highlighted
Resolver II
Resolver II

Re: Sort Column value from biggest to lowest

@phh mmh, could you paste your whole formula in here please

Highlighted
Helper III
Helper III

Re: Sort Column value from biggest to lowest

Hi @TJO,

The first formula is for the gallery and the second formula is for the icon.

SortByColumns(
             Jordprøver5,
             "Ha_x0020_mangler",

                If( varSortAscending,
                Ascending,
                Descending
         )
)



Set(varSortAscending, !varSortAscending)


-Peter

Highlighted
Resolver II
Resolver II

Re: Sort Column value from biggest to lowest

@phh The formulas seem correct.
Could this be a number stored as text issue?  

Highlighted
Helper III
Helper III

Re: Sort Column value from biggest to lowest

Hi @TJO,

 The field is a calculated field and is, and it is set to number.

-phh

 

Helpful resources

Announcements
Community Conference

Power Platform Community Conference

Check out the on demand sessions that are available now!

Watch Now

Experience what’s next for Power Apps

See the latest Power Apps innovations, updates, and demos from the Microsoft Business Applications Launch Event.

Power Platform ISV Studio

Power Platform ISV Studio

ISV Studio is designed to become the go-to Power Platform destination for ISV’s to monitor & manage published applications.

secondImage

Power Platform 2020 release wave 2 plan

Features releasing from October 2020 through March 2021

Tech Marathon

Maratón de Soluciones de Negocio Microsoft

Una semana de contenido con +100 sesiones educativas, consultorios, +10 workshops Premium, Hackaton, EXPO, Networking Hall y mucho más!

Top Solution Authors
Top Kudoed Authors
Users online (6,904)