Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Qlik Open Lakehouse is Now Generally Available! Discover the key highlights and partner resources here.
cancel
Showing results for 
Search instead for 
Did you mean: 
baderbd
Contributor II
Contributor II

Make a measure of the % of lines based on an IF statement

Hi I found a few similar questions on this topic, but none of them seem to be working. 

The IF statement is =if(SUGGESTED_LOCATOR=PUTAWAY_LOCATOR,'Good','override')

 

I tried the following, and while it appears to work, the math is wrong.

=Num( SUM(IF(SUGGESTED_LOCATOR = PUTAWAY_LOCATOR, '1', '0')) / Count(PUTAWAY_LOCATOR), '#0.0%' )

 

Not sure what I am doing wrong here.

Labels (3)
1 Reply
Happy_Mask_Salesman
Partner - Contributor III
Partner - Contributor III

I'm trying to guess, while lacking some context.

For each row, you have two values on two fields, SUGGESTED_LOCATOR and PUTAWAY_LOCATOR.


You want to calculate the % of an equal locator (suggested and putaway) over the total of all the putaway locators.

 

First, check if you need to use the key word "TOTAL" in your Count(PUTAWAY_LOCATOR), it will count the total of all putaway locators based on the dimensions of your chart, if I am correct. This might solve your problem.

 

And if I could I would try it to make it a little easier.


Script solution: Create a flag field in the table, creating a field called FLG_EQUAL_LOCATOR, that would have this expression:

IF(SUGGESTED_LOCATOR = PUTAWAY_LOCATOR, 1, 0) AS FLG_EQUAL_LOCATOR

 

Then just use:

 

=Num( SUM(FLG_EQUAL_LOCATOR) / Count(TOTAL PUTAWAY_LOCATOR), '#0.0%' )