Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
AWS Degraded - You may experience Community slowness, timeouts, or trouble accessing: LATEST HERE
cancel
Showing results for 
Search instead for 
Did you mean: 
LloydM
Contributor
Contributor

comparing measures of a dimension against that of a specific dimension value

hi,

i'm trying to generate this pivot...

LloydM_0-1675693309490.png

from this data...

LloydM_1-1675693346529.png

i would like to compute for the variance as the qty of store1 and store2 must be equal to the qty of whse for each discount category. 

Sum({<store={'whse'}>} total <'discount'> qty) doesn't seem to work.

Thanks in advance.

Labels (3)
1 Solution

Accepted Solutions
ogster1974
Partner - Master II
Partner - Master II

Create a new measure in your data load using applymap.

DataTmp:
LOAD
[store],
[discount],
[qty]
FROM [lib://Community:DataFiles/comparing measures of a dimension.xlsx]
(ooxml, embedded labels, table is Sheet1);

Mapping
DiscountQtyMap:
Load
discount,
qty
Resident DataTmp
Where store='whse'
;

Noconcatenate
Data:
Load
*,
ApplyMap('DiscountQtyMap', discount,0) as "whse qty"
Resident DataTmp
;

Drop table DataTmp;

 

ogster1974_0-1675698023590.png

 

 

 

View solution in original post

2 Replies
ogster1974
Partner - Master II
Partner - Master II

Create a new measure in your data load using applymap.

DataTmp:
LOAD
[store],
[discount],
[qty]
FROM [lib://Community:DataFiles/comparing measures of a dimension.xlsx]
(ooxml, embedded labels, table is Sheet1);

Mapping
DiscountQtyMap:
Load
discount,
qty
Resident DataTmp
Where store='whse'
;

Noconcatenate
Data:
Load
*,
ApplyMap('DiscountQtyMap', discount,0) as "whse qty"
Resident DataTmp
;

Drop table DataTmp;

 

ogster1974_0-1675698023590.png

 

 

 

LloydM
Contributor
Contributor
Author

Thanks... the problem is if there's a store that doesn't have the complete discount category...

LloydM_0-1675763981501.png

the resulting pivot will be as follows...

LloydM_1-1675764642187.png

if  this happens, i would like the regular to appear under store1 with the sum(qty) at zero and the sum(whse qty) will still be at 100.... i guess have to find a way to create the record for store1 discount regular with zero as the qty.  any ideas how this can be done?