Skip to main content
Announcements
Qlik Introduces a New Era of Visualization! READ ALL ABOUT IT
cancel
Showing results for 
Search instead for 
Did you mean: 
SonyaBeketova28
Contributor II
Contributor II

Formula for the measure

Please tell me how to correctly write the formula for the measure of a diagram:

If the variable “filename” contains “AP”, then calculate the ratio of the number of values “1” for the variable “Code by Classifier” to the number of the sum of values “1” and “0” for the variable “Code by Classifier”

 

I tried two formulas, but both did not work correctly, it seems to me:

1. If(WildMatch(filename, '*АР*'), 

   Count(If([Code by Classifier] = 1, 1, 0)) / Count(If([Code by Classifier] = 1 or [Code by Classifier] = 0, 1, 0))

)

2. Count({< [Code by Classifier] = {"1"}, [filename]={"*АР*"} >} [Code by Classifier]) / Count({< [Code by Classifier] = {"0", "1"}, [filename]={"*АР*"} >} [Code by Classifier])

Labels (5)
2 Replies
igoralcantara
Partner - Specialist
Partner - Specialist

When you say it does not work, what do you mean by that? 

a) Does it signore the condition and show the total?

b) Does it show zero?

c) Does it show null?

d) Does it show a value smaller than what it should?

e) Does it show a value bigger than what it should?

Also, you mention "sum of values 1 and 0" but I see a count. Is it a count of code by classifier what you intended to do?

On a separate note, write a KPI with no condition, just the count of Code by Classifier. Then, add a filter pane with 2 fields: filename and code by Classifier. Then, select *AP* (all filenames that contain AP) and Code by Classifier 1. Write down the number. Then select 0 and 1, write down the number in the KPI. Divide one result by the other. Do you get what you expect?

Check out my latest posts at datavoyagers.net
SonyaBeketova28
Contributor II
Contributor II
Author

IMG_9264.jpeg

 Diagram shows null. 
When I mention "sum of values 1 and 0" I mean “sum of number of values 1 and 0” (that is, the function “Count”)