Forum Discussion
Rank by date and quantity
Hello,
Im trying to make a que list by ranking order date and quantity that i will match with available quantity, so if i have 4 available units i will give those to the first 3 orders, since the third order in the example has ordered 2. I have managed to rank the orders by date but cant wrap my head around how to make it consider the quantity in each order.
Expected behaviour of the rank column:
| Order id | Order date | product | quantity | rank |
| 245677 | 2021-11-25 | 45677 | 1 | 1 |
| 246777 | 2021-11-26 | 45677 | 1 | 2 |
| 278899 | 2021-11-27 | 45677 | 2 | 4 |
| 294678 | 2021-11-28 | 45677 | 1 | 5 |
- Anonymous4 years ago
Hi Anonymous ,
Please have a try.
Create a measure.
Measure = CALCULATE(SUM('Table'[quantity]),FILTER(ALL('Table'),'Table'[Order date]<=MAX('Table'[Order date])))Best Regards
Community Support Team _ Polly
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
2 Replies
- amitchandakSuper User
Anonymous , This seem like cumulative Qty
new measure
=sumx(filter( allselected(Table), Table[Date] <= max(Table[Date]) ), [Quantity] )
- AnonymousNot applicable
Hi Anonymous ,
Please have a try.
Create a measure.
Measure = CALCULATE(SUM('Table'[quantity]),FILTER(ALL('Table'),'Table'[Order date]<=MAX('Table'[Order date])))Best Regards
Community Support Team _ Polly
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.