Qlik Community

QlikView App Development

Discussion Board for collaboration related to QlikView App Development.

Highlighted
ksomosera10
Contributor 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
Honored Contributor

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

7 Replies
prachisangewar
Contributor

Re: Create If-else Calculation on Text Object

Hi Kevin,

Can you share your expression ?

Easier to advise .

Thanks.

ksomosera10
Contributor II

Re: Create If-else Calculation on Text Object

Thanks!

Here it is:

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

prachisangewar
Contributor

Re: Create If-else Calculation on Text Object

Try this

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

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.

sasiparupudi1
Honored Contributor III

Re: Create If-else Calculation on Text Object

May be try

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



kulwantsaj219
Contributor II

Re: Create If-else Calculation on Text Object

Try this:

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

effinty2112
Honored Contributor

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