Forum Discussion
Power Pivot Filters
- 6 years ago
Yes, small tweaks, but instead of one measure it is now 4, so rather than post them all here, just grab the PBIX file. It returns a table like this:
I appreciate the candle offer, but I'm just here to help. 🙂
Please see below my test data for the GRN table.
I need the ability to include in my pivot table the last receipt date for a Product and the Qty received, in the location UK or US.
I can work it out for Total Qty received by product by location, just escapes me how to get the qty for the last receipt date.
Thanks
Sam
| Product | Location | GRN | Qty | Supplier | Receipt Date |
| LK-049 | UK | GR 223 | 20 | Howhot | 10/07/2020 |
| LK-049 | US | GR 224 | 5 | Howhot | 11/07/2020 |
| LK-047 | UK | GR 223 | 20 | Howhot | 10/07/2020 |
| LK-047 | US | GR 224 | 5 | Howhot | 11/07/2020 |
| LK-048 | UK | GR 223 | 20 | Howhot | 10/07/2020 |
| LK-049 | UK | GR 225 | 20 | Howhot | 14/07/2020 |
| LK-049 | UK | GR 123 | 20 | Howhot | 10/06/2020 |
| LK-049 | US | GR 124 | 5 | Howhot | 11/06/2020 |
| LK-047 | UK | GR 123 | 20 | Howhot | 10/06/2020 |
| LK-047 | US | GR 124 | 5 | Howhot | 11/06/2020 |
| LK-048 | UK | GR 123 | 20 | Howhot | 10/06/2020 |
| LK-049 | UK | GR 125 | 20 | Howhot | 14/06/2020 |
This is an image of the table, seemed to get mixed up when i posted the original
- edhans6 years agoCommunity Champion
Hi SamTaylor , thank you for the sample data. I wrote a measure that returns this, which is the quantity for the last receipt date of a product by location. Given that your quantites for UK and US are always the same, it is hard to see that my measure works though i this screen shot.
Last Qty and Date by Location = VAR varCurrentLocation = MAX( 'Table'[Location] ) VAR varCurrentProduct = MAX( 'Table'[Product] ) VAR varLastDateByLocation = MAXX( FILTER( ALL( 'Table' ), 'Table'[Location] = varCurrentLocation && 'Table'[Product] = varCurrentProduct ), 'Table'[Receipt Date] ) VAR Result = CALCULATE( SUM( 'Table'[Qty] ), FILTER( ALL( 'Table' ), 'Table'[Location] = VarCurrentLocation && 'Table'[Product] = varCurrentProduct && 'Table'[Receipt Date] = varLastDateByLocation ) ) RETURN Result- SamTaylor6 years agoHelper I
OMG, it's excellent. I thought I might be able to pick up some Dax learning on the side but it's way above me.
I have applied it to the test table below and the result is in the pivot below that. (see image)
But now I am fealing guilty as I need a minor amend, due to my lack of clarity at the start.
I need the UK and US results to be in separate measures, as in the green table. Is this a quick change?
Also, my wife makes candles, can I send you one as a gift?
see www.wrightandgreen.co.uk for a selection of scents.
Thanks
Sam
- edhans6 years agoCommunity Champion
Yes, small tweaks, but instead of one measure it is now 4, so rather than post them all here, just grab the PBIX file. It returns a table like this:
I appreciate the candle offer, but I'm just here to help. 🙂