Skip to main content
Woohoo! Qlik Community has won “Best in Class Community” in the 2024 Khoros Kudos awards!
Announcements
Nov. 20th, Qlik Insider - Lakehouses: Driving the Future of Data & AI - PICK A SESSION
cancel
Showing results for 
Search instead for 
Did you mean: 
ksomosera10
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
effinty2112
Master
Master

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
prachisangewar
Creator
Creator

Hi Kevin,

Can you share your expression ?

Easier to advise .

Thanks.

ksomosera10
Creator II
Creator II
Author

Thanks!

Here it is:

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

prachisangewar
Creator
Creator

Try this

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

Muthu
Partner - Creator III
Partner - Creator III

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.

sasiparupudi1
Master III
Master III

May be try

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



Anonymous
Not applicable

Try this:

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

effinty2112
Master
Master

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