Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Want to see what's currently in public preview? We've pulled it all together in one place. Check it out here
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Calculation Condition for a chart

Hi,

I have a bar chart with three expressions; total charges, total payments and total account balance. My dimension is country name.

I would like to add a calculation condition to a chart that says only pull in charges and payments (already in chart) if the Hospital Account Status = Billed.

Do I add a Calculation Condition on the general tab of the chart? If so, should it read - If(Hospital Account Status="Billed").

Thanks in advance.

Labels (1)
1 Solution

Accepted Solutions
swuehl
Champion III
Champion III

The calculation condition will affect the complete chart, calculate yes/no.

If you want that,

if([Hospital Account Status] = 'Billed',1,0)

could do what you want.

Do you want to limit the two expressions to a subset of the data only, depending on Hospital account status?

For this, of your expression for charges is something like

=sum(Charges)

then change the expression to

=sum({<[Hospital Account Status]= {Billed}>} Charges)

and accordingly for payments.

This is a set analysis expression, you could also try

=sum(if([Hospital Account Status]= 'Billed', Charges))

Hope this helps,

Stefan

View solution in original post

4 Replies
john_duffy
Partner - Creator III
Partner - Creator III

Hello.

A Calculation Condition is used to determine whether or not a chart is to be displayed.

If I understand your question correctly, you want to always display the chart but only total charges and payments if the Account Status = Billed.  In that case you want to add a condition to your expression something like:

Sum(if(Acct_Status = 'Billed',Charges,null()))

John.

swuehl
Champion III
Champion III

The calculation condition will affect the complete chart, calculate yes/no.

If you want that,

if([Hospital Account Status] = 'Billed',1,0)

could do what you want.

Do you want to limit the two expressions to a subset of the data only, depending on Hospital account status?

For this, of your expression for charges is something like

=sum(Charges)

then change the expression to

=sum({<[Hospital Account Status]= {Billed}>} Charges)

and accordingly for payments.

This is a set analysis expression, you could also try

=sum(if([Hospital Account Status]= 'Billed', Charges))

Hope this helps,

Stefan

Anonymous
Not applicable
Author

Hi Stefan,

If I use a conditional expression in a chart, my expression should work only when I select it in list box?

Do you know how to use set analysis or If condtional for all expression?

For example:

My main expression:

Count(B)*count(C)-count(D)*count(F)

It should be calculated only for A=aaa.

The result shold be the same as I use:

Count({<A={'aaa'}>}B)*count({<A={'aaa'}>}C)-count({<A={'aaa'}>}D)*count({<A={'aaa'}>}F)

Thanks,

Not applicable
Author

This is still tremendously helpful - Thank You.