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: 
Not applicable

Using AGGR and ignoring SOME of the dimensions

Hi!!

I´m trying to get to one value per year/month/week that sums up the total participation of provinces at foreign trade(primarily export)

Lets say there are 20 provinces.I can then say that if any province has a relative participation of >=5% , it gets one point(1). If it has less, it gets 0.If i then sum these values, i can measure equal participation at foreign trade.

The database registers each foreign trade operation with a value(FOB), and associates it to a province.

I thought i could establish the initial condition(>=5%) using the IF() function, afterwards use the AGGR function to create a virtual table relating the result(1 or 0 ) to each province, and then use the SUM() function to sum up the values and associate them to the period(Year/month/week)

This is the code that i came up with:

sum(if((sum({$*<Operation={'Export'}>}FOB)/

sum({$*<Operation={'Export'}>+1<Province=>}FOB))>=0.05,1,0))

I use the set analysis qualifier Operation= Export, because i only want to evaluate Export, not import. Furthermore, i added the Province, because when creating the AGGR table, i want it to divide each value FOB value for the provinces by all the values.

Now i messed up with my logic somewhere there, because it doesnt really work.

It works fine( ish)  when i only look at months(i have a cycle group, Year(date) -> Month(date)->Week(date), but the moment i select a certain month or year, i get rubbish.

Please help!

Thanks a lot in advance!

KZF

1 Reply
suryaa30
Creator II
Creator II

Could you please share a sample app.

To your question on how to ignore a selection in a field during aggregation is as below.

I need to sum the charges where  payment type=TTD but ignore any selection on 3 fields shown in green.

Sum({<Code,Hospital,City,PaymentType={'TTD'}>} Charges)