Qlik Community

QlikView App Development

Discussion Board for collaboration related to QlikView App Development.

Announcements
QlikWorld, June 24-25, 2020. Free virtual event for DI and DA gurus. Register Today
cancel
Showing results for 
Search instead for 
Did you mean: 
Highlighted
Creator II
Creator II

Create If-else Calculation on Text Object

Hi,

I have this Text Object that contains formula of IF-ELSE and aggregating a certain fields.

I can't see any result, just a plain dash(-) on Text Object. Can you help me out here?

Thanks in advance!

1 Solution

Accepted Solutions
Highlighted
Master
Master

Re: Create If-else Calculation on Text Object

Hi Kevin,

               Rewrite it as

Sum(if(Category = 'ADMIN',Hours))

Sum the if, don't if the sum.

Muthu has already given you an expression that will work and if you're comfortable with set analysis expression use that one. If you have an expression containing an 'if' using a set analysis expression instead will be quicker and when you're used to the syntax will be easier to read.

Cheers

Andrew

View solution in original post

7 Replies
Highlighted
Creator
Creator

Re: Create If-else Calculation on Text Object

Hi Kevin,

Can you share your expression ?

Easier to advise .

Thanks.

Highlighted
Creator II
Creator II

Re: Create If-else Calculation on Text Object

Thanks!

Here it is:

=IF(Category = 'ADMIN', NUM(SUM(Hours))

Highlighted
Creator
Creator

Re: Create If-else Calculation on Text Object

Try this

=if(Category = 'ADMIN',NUM(SUM(Hours),'#,##0'),0)

Highlighted
Partner
Partner

Re: Create If-else Calculation on Text Object

Try this.

=sum({$<CATEGORY={ADMIN}>} HOURS)..

If the condition didnt satisfy it will automatically give 0, so there is no need of else condition here.

Highlighted
Master III
Master III

Re: Create If-else Calculation on Text Object

May be try

If (substringcount (GetFieldSelections (Category, ':'))>0,NUM(SUM(Hours),0)



Highlighted
Creator II
Creator II

Re: Create If-else Calculation on Text Object

Try this:

sum({<Category={'ADMIN'}>}Hours)

Highlighted
Master
Master

Re: Create If-else Calculation on Text Object

Hi Kevin,

               Rewrite it as

Sum(if(Category = 'ADMIN',Hours))

Sum the if, don't if the sum.

Muthu has already given you an expression that will work and if you're comfortable with set analysis expression use that one. If you have an expression containing an 'if' using a set analysis expression instead will be quicker and when you're used to the syntax will be easier to read.

Cheers

Andrew

View solution in original post