Help with Slice

I am trying to filter & sort sales data and am not understanding how to use the Slice function with other filter and sort functions.
I have a table with 3 columns: Date (there is only 1 date per week in the data), Account and Weekly Sales Amount. I would like to be able to create a view of the table data that will show the top 10 accounts from the pervious week.
I can filter using the date column and the date formulas to only show the previous weeks sales. The formula looks like this:

(thisRow.Date >= Today().DateStartOf("week") - 7 AND 
thisRow.Date <= Today().DateStartOf("week") - 1)

I can then sort based on the Weekly Sales Amounts in a descending sort.
Can someone explain how I would apply a Slice formula to to show only the top 10 sales accounts for the previous week?
Thanks

hi @Ben_Peine ,

The issue is not 100% clear to me, but let me try to help you with what I understand of it.

I created a table that contains only weeks with dates and a random turnover number between 10K & 50K

What I am looking for is the top 10 sales as view of this table.

A few images to show the steps I made

the master demo table with 52 rows (I generated with a button)

We need a top 10, so we use slice

But we don’t need this, we only want to see the rows that meet the criteria, we use a table filter. So we hide or delete step 01 and inject the logic inside the table filter

Anyway it is a good practice to add a dummy doc with your set-up, this avoids confusion. I guess this is partly what you want and you needed a date logic integrated I did not understand since every week has one date and one turn over I assumed. But maybe you have multiple turn overs per week, that was not clear to me.

something else you apply DateStartOf() This is an unsupported function. Don’t worry, this one works, but Coda did not release it (yet) and maybe never will. Who knows the paths of Coda?

Cheers, Christiaan

1 Like

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.