Discussion Board for collaboration related to QlikView App Development.
Hi all,
I have such data, and need to get first sorted value for each product excluding 0’s.
I’ve tried to create Flag but it seems it doesn’t work.
Product | Document | DocType | date | Item Category | FlagPurchasePrice | Purchase Price |
Product 1 | 40 | P | 2018-11-15 | Marketing materials | 1 | 3,90 |
Product 1 | 75 | P | 2018-11-19 | Marketing materials | 1 | 2,40 |
Product 1 | 11 | P | 2019-06-12 | Marketing materials | 1 | 4,80 |
Product 1 | 93 | P | 2019-09-20 | Marketing materials | 1 | 2,40 |
Product 1 | 63 | P | 2020-01-15 | Marketing materials | 1 | 3,47 |
Product 1 | 62 | P | 2020-07-10 | Marketing materials | 1 | 3,67 |
Product 1 | 90 | P | 2020-03-06 | Marketing materials | 1 | 1,75 |
Product 1 | 65 | P | 2020-08-07 | Marketing materials | 0 | 0,00 |
Product 2 | 39 | P | 2018-09-25 | Marketing materials | 1 | 73,00 |
Product 2 | 50 | P | 2019-01-03 | Marketing materials | 1 | 55,70 |
Product 2 | 20 | P | 2019-04-08 | Marketing materials | 1 | 58,00 |
Product 2 | 15 | P | 2019-05-24 | Marketing materials | 1 | 58,00 |
Product 2 | 73 | P | 2019-06-24 | Marketing materials | 1 | 58,00 |
Required result:
Product | Last Purchase Price |
Product 1 | 1,75 |
Product 2
| 58 |
Tested expresions:
I was combinig FirstSortedValue with Aggr and Set Analysis… but still without success for product 1, I am affraid I am missing something…
FirstSortedValue({<FlagPurchasePrice={1}>}PURCHASE_PRICE, -date)
FirstSortedValue(aggr(only({<FlagPurchasePrice={1}>}PURCHASE_PRICE), FlagPurchasePrice, Product), -date)
max(Aggr(FirstSortedValue(PURCHASE_PRICE, FlagPurchasePrice, Product),FlagPurchasePrice))
Any ideas?
Thank You in advance 😊
did you tried this?
https://community.qlik.com/t5/QlikView-App-Development/FirstSortedValue/td-p/737209
try this
FirstSortedValue({<FlagPurchasePrice={'>0'}>}PURCHASE_PRICE, -date)
or check this
If the above post solved your issue, we would appreciate it if you would return to the thread to close things out by using the Accept as Solution button on the post with the suggestion to mark it.
Here are some Design Blog posts that may be of some further help otherwise:
https://community.qlik.com/t5/Qlik-Design-Blog/Set-Analysis-in-the-Aggr-function/ba-p/1463822
https://community.qlik.com/t5/Qlik-Design-Blog/Don-t-get-aggr-avated-using-aggr/ba-p/1464136
Hopefully one of those may get you what you need if the other post did not get you all the way.
Regards,
Brett