Skip to main content
Announcements
Live today at 11 AM ET. Get your questions about Qlik Connect answered, or just listen in. SIGN UP NOW
cancel
Showing results for 
Search instead for 
Did you mean: 
shinnickr
Creator II
Creator II

Calculated Expression

Hi there,

I have been looking around but for some reason am having trouble finding the syntax for what I'm looking for.

I have a dimension "PCI Flag" and it can either be flagged "Yes" or "No".  I have a doughnut chart just showing the two fields and as "Text in Chart" I would like to have a calculated expression showing the % of "Yes".

Calculated Expression.PNG

So, I know this is absolutely terrible syntax, but the calculation I want is something like '=(PCI Flag = Yes) / ((PCI Flag = Yes) + (PCI Flag = No))'

I know I need to use something more like  ( {$<[PCI Flag]={Yes}>} [PCI Flag]) but I am just unsure of the exact syntax that I need.

Any help would be greatly appreciated!

1 Solution

Accepted Solutions
shinnickr
Creator II
Creator II
Author

Thanks for all the help everyone!  I actually got it all figured out.

=num(count({<[PCI Flag] = {'Yes'}>}[Field ID]) / count({<[PCI Flag] = {'Yes', 'No'}>}[Field ID]), '##.##%')

View solution in original post

7 Replies
prat1507
Specialist
Specialist

Use

Sum({<[PCI Flag]={'Yes'}>} Amt)/(Sum({<[PCI Flag]={'Yes'}>} Amt)+Sum({<[PCI Flag]={'No'}>} Amt))


or


Sum({<[PCI Flag]={'Yes'}>} Amt)/(Sum(Amt)


Regards

Pratyush

krishnacbe
Partner - Specialist III
Partner - Specialist III

Do you need to provide the % of Yes and not for No

krishnacbe
Partner - Specialist III
Partner - Specialist III

Hope attached sample will help if you need to show the % of both No & Yes

shinnickr
Creator II
Creator II
Author

Yeah just the % of yes.  So in the picture it's Yes = 222; No = 29.  What I want to show is 222/(222+29), which would be 88.45%

krishnacbe
Partner - Specialist III
Partner - Specialist III

Then the expressions shared by Pratyush will help you.

vinieme12
Champion III
Champion III

Dimension

[PCI Flag]



Expression

=count([PCI Flag]) / count(TOTAL [PCI Flag])


Vineeth Pujari
If a post helps to resolve your issue, please accept it as a Solution.
shinnickr
Creator II
Creator II
Author

Thanks for all the help everyone!  I actually got it all figured out.

=num(count({<[PCI Flag] = {'Yes'}>}[Field ID]) / count({<[PCI Flag] = {'Yes', 'No'}>}[Field ID]), '##.##%')