SLICE Filter Column by Desc. (Highest to Lowest) and LIMIT to 10 Rows Only

Hi Gurus,
Hope you can help. I’ve created a SLICE on the columns I’d like to see. How could I arrange a column within the SLICE to descending order (highest to lowest value) and limit the rows to 10 only (that is to say only the top 10).

So far the only condition I have in my slice is [ACTIVITY] = “RIDE” but want to include the other conditions.

Thanks in advance!
Tony

Solved Solved
0 15 1,438
1 ACCEPTED SOLUTION

Hi @Tony_Insua,

Good to know it works.I may mention here that this solution is by @Steve and not me. I just added a minor condition based on your latest update. I thought @Steve mightt have retired for the day and you are active on the community portal, so I may add that small update to save you some time.

Regarding sorting by highest to lowest, may we know how you are presenting this slice information. You may use “Sort By” option to sort column on “Distance Ride” column ( descending) in deck and table views under UX --> Views --> Table or Deck View --> View Options

View solution in original post

15 REPLIES 15

Steve
Platinum 4
Platinum 4

Highest to lowest what?

What are you trying to accomplish with is one slice?

Highest to lowest DISTANCE RIDE limit to 10 rows only. In gsheets that would be selecting the column Distance Ride ORDER BY DESC LIMIT 10 in a query. Not sure how to do that here in the slice.

So you want the slice to include only the top 10 longest-distance rides?

IN(
  [_THISROW],
  TOP(
    ORDERBY(
      FILTER("table-slice-uses", TRUE),
      [DISTANCE_RIDE],
        TRUE
    ),
    10
  )
)

Replace table-slice-uses with the name of the table the slice is based on.

Hi Steve,
Thanks. I’ve placed this expression the ROW FILTER CONDITION. It netted me the following table.

This did not include any of the [ACTIVITY] = “RIDE” rather other activities included. I’d like to filter just the “RIDE” activities LONGEST DISTANCE, Top 10 from Highest to Lowest. Here’s what I tried but doesn’t seem to work:

SLICE

Please try

IN(
[_THISROW],
TOP(
ORDERBY(
FILTER(“ACTIVITY DATA”, [ACTIVITY]=“RIDE”),
[DISTANCE_RIDE],
TRUE
),
10
)
)

@Suvrutt_Gurjar this is fantastic! Worked great, thank you. One minor question if possible. How could I change the order so that the Distance Ride is shown from highest to lowest from the top? Currently, this shows lowest to highest from the top.
Thanks!

Hi @Tony_Insua,

Good to know it works.I may mention here that this solution is by @Steve and not me. I just added a minor condition based on your latest update. I thought @Steve mightt have retired for the day and you are active on the community portal, so I may add that small update to save you some time.

Regarding sorting by highest to lowest, may we know how you are presenting this slice information. You may use “Sort By” option to sort column on “Distance Ride” column ( descending) in deck and table views under UX --> Views --> Table or Deck View --> View Options

Hi Suvrutt,
Thanks to both of you.

So what I think would be best to show this information would be to have this SLICE part of a DASHBOARD view called “Top Efforts” in which would be a combination of a Filter View with buttons that includes RIDE, RUN, YOGA, etc in which when selected, would showcase the associated SLICE in a TABLE view.

I’m reading up on how I can do this but not sure if it’s possible. The columns are different between the activities so we’ll see.

Still learning as much as I can!
Thanks

Hi @Tony_Insua ,

If you are using table view for the slice ,you should be able to use the “Sort By” option in table view’s settings under UX --> Views

Hi @Tony_Insua,

You have mentioned user based inputs in the dashboard. You may wish to take a look at the following sample app. Ofcourse, the app is meant for catering to inputs from one user. You may need to have a separate user table to store selection inputs by each user in the dashboard.

https://www.appsheet.com/samples/Allow-the-user-to-filter-a-view-based-on-a-form?appGuidString=91266...

Hi @Suvrutt_Gurjar it’s funny you mention the sample app - that’s exactly what I have infront of me to study. I’ll dive into this and play around with App Sheets to achieve this.

Your “Sort By” suggestion on the Table View actually worked in terms of presenting Highest to Lowest – thank you!

The next big thing that I’m trying to read up more on is CHARTS. I haven’t been able to find any example apps that are truly rich with great charting and how to’s. Any advice in pointing me in the right direction? I find it’s been difficult as you can’t arbritarily pick the X and Y axises like in google sheets. Maybe of for another topic…

Thanks for all your help!

Hi @Tony_Insua,

Great to know the sample app is relevant to you.

For graphs and charts,if you wish to explore more options, the AppSheet team and our community colleagues @tsuji_koichi ,@Fabian have shared in some very innovative tips and tricks in the Tips and Tricks section. Please simply search by “Charts” and “Graphs”

Hi @Suvrutt_Gurjar
I wonder if you know what the following issue is with this new problem I’m faced with the expression.

I’ve reorganized my table in google sheets so that “RIDE” and “INDOOR BIKE TRAINER” share some similar columns instead of all exclusively separate columns which I had done in the past. When I try the formulation below, I don’t seem to be getting the same result in terms of ordering the DISTANCE column from Lowest to Highest which is what I’m looking for. It seems that there is no order at all. The ACTIVITY = “RIDE” seems to work (as it does not include any INDOOR BIKE TRAINER activities but there’s no order in the DISTANCE column like before. Here’s a screen shot of the table: Distance is not in any order. I wonder what’s change? Any insights or articles on how to solve for this?
Thanks

Expression Used (per your original suggestion):

IN(
[_THISROW],
TOP(
ORDERBY(
FILTER(“ACTIVITY DATA”, [ACTIVITY]=“RIDE”),
[DISTANCE],
TRUE
),
10
)
)

This expression comes back all TRUE and it worked before but not in this new way.

You seem to have changed the name of "Distance"column to [Distance] from [Distance_Ride]

Hope eyou have accordingly changed the "Sort By"column setting in the table view. Please note that the sorted order will reflcet in your table view in the app and not in the backend data source table.

Hi Survrutt, thanks! You were correct, the order is set in the “SORY BY” column setting in the UX. Thanks for the reminder agian. Cheers

Top Labels in this Space