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: 
justcotto
Contributor III
Contributor III

Divide one expression by another expression

I have two expressions:

count({<RECORD_TYPE={'HIRE'}>} BUSINESS_UNIT)

and

count({<RECORD_TYPE={'HEAD_COUNT'}>} BUSINESS_UNIT)

I want to divide the number of people hired by the head count and put this into a chart. How can I achieve this?

7 Replies
Anil_Babu_Samineni

Do like this

count({<RECORD_TYPE={'HIRE'}>} BUSINESS_UNIT)

/

count({<RECORD_TYPE={'HEAD_COUNT'}>} BUSINESS_UNIT)

Best Anil, When applicable please mark the correct/appropriate replies as "solution" (you can mark up to 3 "solutions". Please LIKE threads if the provided solution is helpful
vishsaggi
Champion III
Champion III

May be this?

= count({<RECORD_TYPE={'HIRE'}>} BUSINESS_UNIT)/count(TOTAL {<RECORD_TYPE={'HEAD_COUNT'}>} BUSINESS_UNIT)

its_anandrjs

What out put you need can you share some sample here.

justcotto
Contributor III
Contributor III
Author

Thank you but how do I get the expression to print out as a percentage?

its_anandrjs

You can try this way for percentage display

NUM((count({<RECORD_TYPE={'HIRE'}>} BUSINESS_UNIT)

/

count(TOTAL {<RECORD_TYPE={'HEAD_COUNT'}>} BUSINESS_UNIT)),'#,##0%')

Or

NUM((count({<RECORD_TYPE={'HIRE'}>} BUSINESS_UNIT)

/

count( {<RECORD_TYPE={'HEAD_COUNT'}>} BUSINESS_UNIT)),'#,##0%')

vishsaggi
Champion III
Champion III

Use the Num() function as mentioned by Anand. Or you can use Number format from the Number tab of your chart properties. Like.

Capture.PNG

rwunderlich
Partner Ambassador/MVP
Partner Ambassador/MVP

To get the value to display as a percentage, you can use the Number format pane to format as Pct. Alternatively (like when you don't have a Number dialog) you can wrap the expression in a num() function to format.

num(

  count({<RECORD_TYPE={'HIRE'}>} BUSINESS_UNIT)

  / count(TOTAL {<RECORD_TYPE={'HEAD_COUNT'}>} BUSINESS_UNIT)

,'0.0%')


The num() function supplies a format pattern describing how the value should be formatted for display.


http://help.qlik.com/en-US/qlikview/12.1/Subsystems/Client/Content/Scripting/FormattingFunctions/Num...

http://help.qlik.com/en-US/qlikview/12.1/Subsystems/Client/Content/conventions-number-time-formats.h...


-Rob

http://masterssummit.com

http://qlikviewcookbook.com