Skip to main content
Announcements
NEW: Seamless Public Data Sharing with Qlik's New Anonymous Access Capability: TELL ME MORE!
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Ratio

Hello

How do I create a ratio (not as a percentage)...

For example, I have a sales value of 1754 and a demo value of 764

How can I display the sales:demo ratio  (1754 : 764) in its lowest form?

Many thanks

7 Replies
Gysbert_Wassenaar

dual( sales_value & ' : ' & demo_value, sales_value/demo_value)

Or are you asking how to calculate the greatest common divisor? There's no Qlikview function to do that. You'll have to calculate it before hand or use a macro.


talk is cheap, supply exceeds demand
sunny_talwar

But gwassenaarthis won't be in its lowest form. The lowest form would be displaying it as  877:382

Am I correct sabahsdada ? This is what you are looking to do???

Not applicable
Author

Yes you are right, I need to see this value in its lowest form

sunny_talwar

Still looking for ways to achieve what you wanted, but have been unsuccessful so far. Came across this link: ‌, where you can vote for a function which can help you with what you are trying to achieve.

HTH

Best,

Sunny

mjayachandran
Creator II
Creator II

you can try doing it in the script.

see the link below:

How to calculate the GCD(Greatest Common divisor)

once you have the gcd value, then u can use the formula,

=salesvalue/GCDfield &":"&demovalue/GCDfield

Hope it helps

sunny_talwar

Used a macro to achieve what you wanted (Found the macro here: How to calculate the GCD(Greatest Common divisor))

Please find attached the application and see if this is helpful.

Best,

Sunny

vvvvvvizard
Partner - Specialist
Partner - Specialist

='1 : '&round( demo_value/sales_value ,2)