简体   繁体   中英

QLikView calculated dimension with aggregation w.r.t. other dimension in pivot-table

In a pivot table, I have one calculated dimension with complex expression:

pick(1+match(IF([Corporate Account]='OTHER','[Sales Account]', 
'[Corporate Account]'),...,...,...),...,...,...,...)

In another dimension, I want to sum revenu with respect to this first dimension. More precisely, I want to have value for this new calculated dimension be 'A' or 'B' depending on the total revenue with respect to the first field.

So far, I came up with

=AGGR( IF(Sum(Revenue)>10,'A','B'),
$(=pick(1+match(IF([Corporate Account]='OTHER','[Sales Account]', 
'[Corporate Account]'),...,...,...),...,...,...,...)))

and this is not correct (for all rows, output is Null()).

Would you have an idea of what is the right syntax ?

Many thanks in advance

Without seeing your full dimension expression it is not that easy to diagnose the issue, however, I tried to recreate your expression:

=aggr(if(sum(Revenue)>10,'A','B'),
$(=pick(match(IF([Corporate Account]='OTHER','[Sales Account]', '[Corporate Account]'),
'[Corporate Account]', '[Sales Account]'),'[Sales Account]', '[Corporate Account]')))

I noticed that if I put the dimensions in the pick() entries in quotes then the expression is evaluated fine since pick() would return a quoted value, eg '[Sales Account]' which is then evaluated by $() to [Sales Account] and so becomes a "real" dimension which aggr() can use as an aggregation dimension.

If this doesn't work, please could you add your full expression?

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM