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

What is wrong in this if Statment?

=if(ySeg='Total',sum({1<ySeg={'S02','S03','S04'},yMonth={'$(=only(yMonth))'}>} yRev), yRev)

Please write the correct statement for this one.

I want to enter the sum of S02,S03,S04 in a grid against the Seg is Total.

Best Regards,

Gaurav Tyagi

4 Replies
swuehl
MVP
MVP

ySeg is your dimension and you want to check if your current line is a total line or a detail line? Something like this?

'Total' is just a label, not a dimension value you can check. Use dimensionality() function for this (or secondarydimensionality() with a pivoted dimension), something along these lines:

=if(dimensionality() = 0,sum({1<ySeg={'S02','S03','S04'},yMonth={'$(=only(yMonth))'}>} yRev), yRev)

edit: depending on the number of your dimensions you are calculating (sub-)totals for, you need to adapt the value you check against (i.e. zero in my sample).

Check the HELP for dimensionality() and also check using =dimensionality() as expression in your chart)

Not applicable
Author

Thanks for the reply

'Total' is acctually a dimension.

I already changed my logic but will check this dimensionality function now.

Not applicable
Author

Hi,

You may try like sum(if(......))

else attach some sample file, which will help to solve your prob....

sujeetsingh
Master III
Master III

just paste a sample and Explain what u want  finally...