Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
I am trying to build a rather complex expression in Qlik Sense Enterprise to produce a single measure for 'weight.' There are a few dimensions that determine HOW to group the weights and they are based on related tables (one table more detailed than the other). Your guidance is much appreciated!!
The high-level table (order_prod) is grouped by order_prod_id
The low-level table (order_prod_inv) is grouped by order_prod_inv_id
Sum(distinct IF(
aggr(Sum(IF(Product_Type = 'Unit' and (category_id = 3 or category_id = 4 or category_id = 5), qty_base * medicated_weight_base,
IF(Product_Type = 'Unit' and category_id <> 2 and category_id <> 3 and category_id <> 4 and category_id <> 5, '0',
IF(Product_Type = 'Prepack', qty_base * weight_base,''))))),
order_prod_inv_id),
aggr(Sum(IF(Product_Type = 'Unit' and category_id = 2, quantity * sold_weight_base),
IF(Product_Type = 'Bulk', quantity * sold_weight_base, ''))),
order_prod_id,'')
It would be rather difficult to decipher this without a sample, would you be able to share a sample to check this out?
Thanks for your interest, Sunny! My firm got hacked earlier this year so we are super sensitive about sharing anything right now. Can you tell me whether or not Qlik Sense allows for a conditional aggregate reflecting multiple dimensions in the same expression?
Below is a more rudimentary example of what I'm trying to accomplish with two conditions (containing different measures and grouped at different dimensions) in a single measure
#1 if product_type = 'unit' then sum(aggr(sum(qty_base * medicated_weight_base), order_prod_inv_id),
#2 if product_type = 'prepack' then sum(aggr(sum(qty_base * weight_base), order_prod_id),
#3 null
Hope this provides a more comprehensive picture of what i'm trying to do. Thanks!