Forum Discussion
JBG
8 years agoRegular Visitor
highest value by category
Hello everyone!! I am trying to extract the data from the latest date record (ex: for each customer last delivery date & delivered quantitiy) I am able to select the last date but I get...
- 8 years ago
Hi there
This is possibly what you are after?
Measure = CALCULATE ( SUM ( 'Table1'[StorageLevelAfterDelivery(kg)] ), FILTER ( 'Table1', 'Table1'[ShiftEndDate] = MAX ( 'Table1'[ShiftEndDate] ) ) )
GilbertQ
8 years agoSuper User
Hi there,
Could you please post some sample data and the expected outcome so that we can look at how to solve your current challenge?
Could you please post some sample data and the expected outcome so that we can look at how to solve your current challenge?
JBG
8 years agoRegular Visitor
Hello Gilbert,
Here is an example of what I would like to do :
| SiteName | ShiftCode | ShiftEndDate | StorageLevelAfterDelivery(kg) |
| A | 23 | 20/07/2018 | 33 600 |
| A | 26 | 15/12/2017 | 34 300 |
| A | 30 | 08/03/2018 | 34 300 |
| A | 52 | 05/04/2018 | 34 300 |
| A | 37 | 30/01/2018 | 35 000 |
| A | 123 | 16/02/2018 | 35 000 |
| B | 45 | 15/12/2017 | 16 800 |
| B | 89 | 07/08/2018 | 32 900 |
| B | 95 | 15/03/2018 | 33 250 |
| B | 75 | 21/03/2018 | 33 250 |
| B | 78 | 27/02/2018 | 33 600 |
| B | 62 | 29/03/2018 | 33 600 |
| C | 54 | 15/12/2017 | 34 300 |
| C | 68 | 08/03/2018 | 34 300 |
| C | 145 | 05/04/2018 | 34 300 |
| C | 96 | 30/01/2018 | 35 000 |
| C | 102 | 16/02/2018 | 35 000 |
| SiteName | ShiftCode | LatestShiftEndDate | StorageLevelAfterDelivery(kg) |
| A | 23 | 20/07/2018 | 33 600 |
| B | 89 | 07/08/2018 | 32 900 |
| C | 145 | 05/04/2018 | 34 300 |
Thanks by advance
- v-yuta-msft8 years agoCommunity Support
Hi JBG,
Create a measure using DAX as below:
LatestShiftEndDate = CALCULATE(MAX(Table1[ShiftEndDate]), ALLEXCEPT(Table1, Table1[SiteName]))
Regards,
Jimmy Tao
- JBG8 years agoRegular Visitor
Hi Jimmy,
Thanks for your answer. Unfortunatley, I still have the same problem which is it doesn't filter one data (the latest) per site name. When I wwant to know quantities per site at the latest date, I still have several datas per site... If you have another advice... Thanks
- GilbertQ8 years agoSuper User
Hi there
This is possibly what you are after?
Measure = CALCULATE ( SUM ( 'Table1'[StorageLevelAfterDelivery(kg)] ), FILTER ( 'Table1', 'Table1'[ShiftEndDate] = MAX ( 'Table1'[ShiftEndDate] ) ) )