Skip to main content
Announcements
Have questions about Qlik Connect? Join us live on April 10th, at 11 AM ET: SIGN UP NOW
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Getting expression total on the first row based on an IF statement

Hey Guys,

I just created an expression based on an IF statement but I can't get the SUM total on the first row even  though the expression total is selected on the Expression tab. Please any idea on how to figure this out will be truly appreciated.

Thanks,

Simon.

9 Replies
swuehl
MVP
MVP

And your expression looks like ...?

If your if() statement is embedded in the aggregation, I think it should work.

If your if() statement is testing dimension values, outside the aggregation, you need to use advanced aggregation to get the total:

=Sum( Aggr( If(Dim ='A', Sum(Value1), Sum(Value2) ), Dim))

alexandros17
Partner - Champion III
Partner - Champion III

are you using a pivot table ?

If yes, try to transform to a straight table and verify the result, if this is the case (otherways let me know) you have to use dimensionality finction

Not applicable
Author

Hi ,

I am using a straight table but its not given me the total on the first row.

Not applicable
Author

Hi ,

my expression is as follows:

if(column(3) <0,0.25 * column(3)).

It give me the sum total on the individual fields but not the grand total on the first row. If I add sum to the expression, it show the sum total on the first row as 0.

swuehl
MVP
MVP

And the expression in column(3) looks like...

Not applicable
Author

Column(1) : Sum(Distinct )Column(2) : Sum( + + )

So column(3) : Column(1) - Column(2).

swuehl
MVP
MVP

Sorry, your posted expressions don't make sense to me.

Could you upload a small sample QVW that demonstrates your issue?

Not applicable
Author

Hi, Sweuhl,

I have figure it out. Thanks for your contribution all thesame.

gsbeaton
Luminary Alumni
Luminary Alumni

Hi Simon,

Try putting the the function column(3) on its own into your expression, is it reproducing the desired result?  There is no reason why your expression shouldn't work, even with an IF.  Total's should also work.

You are testing for values less than 0 (ie, negative values) so your expression is only going to fire if the value in column 3 is negative.  Is this what you meant?  Sorry if this is vague, there's not a lot to go on!

If you can post your QVW I'd be happy to take a look.

George