martingaleh
Board Regular
- Joined
- Jul 18, 2011
- Messages
- 83
I have 1 table with only 116k rows (Not 116M) and its broken down by customer |sales| invoice number
I want a table that aggregates sales by customer and I want it to just show the top 10 customers. Here's my dax:
sAmt = sum(sales)
calculate([sAmt],filter(table[customer],RANKX(all(table[customer]),abs([sAmt]))<=10))
which failed miserably because it filtered nothing and gave me every amount.
Then I tried filter(all(table[customer]),rankx(all(table[customer]),abs]),abs([sAmt]))<=10))
which filtered nothing
but when I tried addcolumns(all(table[customer]),"rank",rankx(all(table[customer]),abs([sAmt])))
The rank is right. Maybe the filter context inside filter is different from the one with addcolumns
A suggested syntax here:
https://powerpivotpro.com/2014/11/displaying-top-n-bottom-n-and-all-others/
would be
filter(table,rankx(all(table[customer]),abs]),abs([sAmt]))<=10))
but filter would iterate on every single row in the table which is 116k. Plus I thought calculate works in that filter provides a table of 1 column of just the customers I want and then calculate calculates the value of just those customers
I want a table that aggregates sales by customer and I want it to just show the top 10 customers. Here's my dax:
sAmt = sum(sales)
calculate([sAmt],filter(table[customer],RANKX(all(table[customer]),abs([sAmt]))<=10))
which failed miserably because it filtered nothing and gave me every amount.
Then I tried filter(all(table[customer]),rankx(all(table[customer]),abs]),abs([sAmt]))<=10))
which filtered nothing
but when I tried addcolumns(all(table[customer]),"rank",rankx(all(table[customer]),abs([sAmt])))
The rank is right. Maybe the filter context inside filter is different from the one with addcolumns
A suggested syntax here:
https://powerpivotpro.com/2014/11/displaying-top-n-bottom-n-and-all-others/
would be
filter(table,rankx(all(table[customer]),abs]),abs([sAmt]))<=10))
but filter would iterate on every single row in the table which is 116k. Plus I thought calculate works in that filter provides a table of 1 column of just the customers I want and then calculate calculates the value of just those customers