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

How to perform aggr on the dimensions which are not part of the chart

Hi ,

      We have following data. and trying to display in a straight table

      Dimension: age_group

      Expression: sales for eache age_group but need to exclude the member sales who crosses 350.

      The expected straight table is :

      Age_group    sales (excluded 350)

      85-95             175

      65-75             176

as 103,100 and 104 crosses 350 sale.

    I tried to use following expression but it is not working when we dont have mbr_id in the stright table.

     sum(sales)-max(aggr(sum(sales),mbr_id))

Data table:

mbr_idage_groupsales
10085-95100
10085-95200
10085-9550
10185-95100
10185-9525
10185-9550
10265-75100
10265-7526
10265-7550
10365-75100
10365-75200
10365-75100
10485-95361

Thanks

7 Replies
JonnyPoole
Employee
Employee

If the total sales for the mbr_id (regardless of age group) is <= 350, then include the member sales and show me the sales by age groups just for those member ids:

sum( if(  aggr( sum ( sales) , mbr_id) <= 350, aggr( sum ( sales) , mbr_id)))

Capture.PNG.png

jyothish8807
Master II
Master II

Hi Dasu,

Try this:

Dimension1:

=if(aggr(sum(sales),mbr_id)<350,mbr_id)

Dimension2:

age_group

Exp1:

Sum(sales)

Note: For Dimension 1 select supress for null value.

Regards

KC

Best Regards,
KC
Anonymous
Not applicable
Author

Hi,

      There is an issue here. 85-95 group should have only 175 but in the application you have provided got value 525 that means it is not doing the condition on member level.

JonnyPoole
Employee
Employee

It is correct (i think) because for this age group member 100  is 350 and  and member 101 is 175 (350+175 = 525)

The filter is <= 350.

If it was < 350  then you would be correct.

Which one do you want ?

Anonymous
Not applicable
Author

This is good if i have just one fact value that is sales. In case if i have another fact called asset and there should not be any data exclusion then how will we proceed?. See the screen shot

jyothish8807
Master II
Master II

Hi Dasu,

What do you want to show in asset field?

Regards

KC

Best Regards,
KC
jyothish8807
Master II
Master II

Hi Dasu,

Is this is what you want?

Regards

KC

Best Regards,
KC