Skip to main content
Announcements
Qlik Connect 2024! Seize endless possibilities! LEARN MORE
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

How to count num shops having stock 0 grouped at shop level?

   

Raw Data:Stock
Field ITEM_PART_NUMBER Shop AShop BShop CShop D
Items in substitution group 1 (PIVOT_ITEM_TYPE = 'SUBST'Item 1Substituting item1110
Item 2Substituded item1000
Item 3Substituded item1000
Item 4Substituded item1010
Item 5Substituded item1010
Is Stock for all items in Substitution Group 1 aggregated At shop Level > 0 for previous day?Yes as stock is 5Yes as stock is 1Yes as stock is 3No as stock is 0
Thereby, KPI should return me count of shops = 1 having stock 0 grouped at substitution group 1 level and at each shop for the previous day
My question is how do I calculate a KPI which will return me only the count of shops having stock 0 grouped at substitution group 1 level and at each shop for the previous day?
I have tried the following possibilities but they are not working:
Aggr(sum({$<Date={">=$(=max(Date)-1)<$(=Date)"},Pivot_Item_Type = {'SUBST'}}QTY_STOCK)<=0, SHOP_CODE)
if(Aggr(sum({$<Date={">=$(=max(Date)-1)<$(=Date)"}>}QTY_STOCK), SHOP_CODE, ITEM_PART_NUMBER)=0, Count(DISTINCT SHOP_CODE),1)
if(Aggr(sum({$<Date={">=$(=max(Date)-1)<$(=Date)"}>}QTY_STOCK), ITEM_PART_NUMBER, SHOP_CODE)<=0,0,Count({$} SHOP_CODE))
0 Replies