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

Announcements
Join us in Bucharest on Sept 18th for Qlik's AI Reality Tour! Register Now
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Conditional Total

Hi!

is it possible to have conditional subtotals on the total line?

i wish for example to do the following

two article types;

9 level, ie 90001200

8 level ie  80004000

Pseudo:

if(left(articletype,1) = '8', show 0 in the total row but show row values

if(left(articletyp,1) = '9', show aggregated values in total and show row values.

i have attached my application for better understanding.

Best

Brad

1 Solution

Accepted Solutions
jerem1234
Specialist II
Specialist II

See if attached is what you want, as swuehl mentions, you need dimensionality:

if(dimensionality()<>1, sum(Round(Aggr(

sum(if([OrderYearWeek] >=

weekyear(today()-(7 * vAntalVeckor))&num(week(today()-(7 * vAntalVeckor)),00)

,[Ordered qty],0))

/vAntalVeckor, Category, Colour, LagerArtikel_, SvItemdesc, [Lager/Risk]), 1)) ,

sum({<LagerArtikel_= {'=left(LagerArtikel_,1)<>8'}>}Round(Aggr(

sum({<LagerArtikel_= {'=left(LagerArtikel_,1)<>8'}>}if([OrderYearWeek] >=

weekyear(today()-(7 * vAntalVeckor))&num(week(today()-(7 * vAntalVeckor)),00)

,[Ordered qty],0))

/vAntalVeckor, Category, Colour, LagerArtikel_, SvItemdesc, [Lager/Risk]), 1))

)

Hope this helps!

View solution in original post

7 Replies
swuehl
MVP
MVP

Seems very, very close to your other thread.Please try to avoid posting the same question multiple times.

Again, I would suggest looking into dimensionality() / secondarydimensionality()

srchilukoori
Specialist
Specialist

What is the field name of the article type in the attached sample.

Not applicable
Author

Lagerartikel_

Sent from my iPhone

jerem1234
Specialist II
Specialist II

See if attached is what you want, as swuehl mentions, you need dimensionality:

if(dimensionality()<>1, sum(Round(Aggr(

sum(if([OrderYearWeek] >=

weekyear(today()-(7 * vAntalVeckor))&num(week(today()-(7 * vAntalVeckor)),00)

,[Ordered qty],0))

/vAntalVeckor, Category, Colour, LagerArtikel_, SvItemdesc, [Lager/Risk]), 1)) ,

sum({<LagerArtikel_= {'=left(LagerArtikel_,1)<>8'}>}Round(Aggr(

sum({<LagerArtikel_= {'=left(LagerArtikel_,1)<>8'}>}if([OrderYearWeek] >=

weekyear(today()-(7 * vAntalVeckor))&num(week(today()-(7 * vAntalVeckor)),00)

,[Ordered qty],0))

/vAntalVeckor, Category, Colour, LagerArtikel_, SvItemdesc, [Lager/Risk]), 1))

)

Hope this helps!

Not applicable
Author

this is correct!

Thank you

However furthering my knowledge, is it not possible to show the total row  but not show the aggregated value in the total column cell for all '8' lagerartikel_.

in SAP BW this is possible but i believe in QV this is potentially not available?

Best

Brad

jerem1234
Specialist II
Specialist II

So you want the total row still shown for the 8's, but not show any value? You'll have to add another "if" to your equation like:

if(dimensionality()<>1, sum(Round(Aggr(

sum(if([OrderYearWeek] >=

weekyear(today()-(7 * vAntalVeckor))&num(week(today()-(7 * vAntalVeckor)),00)

,[Ordered qty],0))

/vAntalVeckor, Category, Colour, LagerArtikel_, SvItemdesc, [Lager/Risk]), 1)) ,

if(left(maxstring(LagerArtikel_), 1) <> 8,

sum({<LagerArtikel_= {'=left(LagerArtikel_,1)<>8'}>}Round(Aggr(

sum({<LagerArtikel_= {'=left(LagerArtikel_,1)<>8'}>}if([OrderYearWeek] >=

weekyear(today()-(7 * vAntalVeckor))&num(week(today()-(7 * vAntalVeckor)),00)

,[Ordered qty],0))

/vAntalVeckor, Category, Colour, LagerArtikel_, SvItemdesc, [Lager/Risk]), 1)),

' ')

)

Here since there is more than one LagerArtikel_ for the total, you'll need to just take one of these by using maxstring. Then for the total, I just used the blank space for the 8's(you can put whatever you want there). Hopefully that is what you're asking, if not can you give an example of of what you want shown.

Hope this helps!

Not applicable
Author

correct thank you