Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hy there
I've create a meassure with he name Success Rate Data with the function:
count(if(tcdatasuccess = 'OK',tcdatasuccess))/
(count(if(tcdatasuccess = 'OK',tcdatasuccess))+count(if(tcdatasuccess = 'NOK',tcdatasuccess)))
In my Qlik Sense project I'm using a polygon Map. The fieldmap is the iso code and in the function I've to make several calculation where I've to use the code several times. I didn't found out, how I can access the meassure field.
Isn't it possible to access a meassure or dimension field directly in the formula field?
Thanks & Regards
Sarah
If you need to use the ratio in more places you can put the expression in a variable. For now you will have to create the variable in the load script
SET vSuccessRatio = count({<tcdatasuccess = {'OK'}>}tcdatasuccess)/count({<tcdatasuccess =
{'OK','NOK'}>}tcdatasuccess);
In expressions you can then (re)use the variable: if( $(vSuccessRatio) < 0.5, ..., ...)
Hey Gysbert
It sound's very interesting. I tried as you suggested. But the result is only a -
I also used the line below, but the - still remains.
vSuccessRatio: count(tcdatasuccess)
What is wrong with my code?
In the script you use the SET or LET keyword to create variables:
SET vSuccessRatio = count({<tcdatasuccess = {'OK'}>}tcdatasuccess)/count({<tcdatasuccess =
{'OK','NOK'}>}tcdatasuccess);
After adding the code to create the variable you will have to reload the document to actually create the variable.
Ah ok, I tought it could be possible to declare a variable in the formula editor.
With declaring a variable in the script editor it was working.
Thanks for clarificaton.
Hi Sarah,
Variable support via the UI is not yet implemented but is something in consideration for a future release.
Mike T
Qlik