Skip to main content
Announcements
Qlik Connect 2024! Seize endless possibilities! LEARN MORE
cancel
Showing results for 
Search instead for 
Did you mean: 
stig1984
Creator II
Creator II

Problems with Excel sumifs() equivalents

I am attempting to create an expression that sums data for a certain set of criteria and then calculates this as a percentage of a larger set of criteria.

Excel Capture.PNG

In the above example I need to see the percentage of waste product on the Nectarines packed on prod_run_no 200052 per FPInnerCount as a percentage of the total FPInnerCount for all three  Prod_Class's, but without displaying Class 1

In Excel I would do this using a sumifs() (shown above) formula but I cannot get it to correctly total as a percentage in Qlikview - I can get actual quantities easily enough but I need the percentage of the whole production run (and then scaled up by day, week, month etc.) with Product and Category as dimensions.

I have tried various sum(if(  )) statements as suggested in other threads and have tried to create additional variables in the script when loading (such as LOAD sum(if(Prod_Class='Class 2',FPInnerCount)) as Class2Count) but nothing has worked.

I have been working on this now for most of the afternoon trying different ideas and am out of ideas.

Please help.

thanks

1 Solution

Accepted Solutions
amayuresh
Creator III
Creator III

I think, this answer your question.

I have data like,

2.PNG

with Output as,

1.PNG

Dimension:

Prod_Run_No, Prod_Class

Expression:

Total=sum(FPlnnerCount)

Sub Total=Sum(TOTAL <Prod_Run_No> FPInnerCount)

% of Sub Total=sum(FPInnerCount)/Sum(TOTAL <Prod_Run_No> FPInnerCount)

Presentation Tab:

Checked "Show Partial Sums" for Dimension Prod_Class

View solution in original post

5 Replies
swuehl
MVP
MVP

You can try something like this using set analysis

=

Sum( {<Prod_Class = {'WASTE'}, PROD_RUN = {200052}>} FPInnerCount)

/

Sum( {<PROD_RUN = {200052}>} FPInnerCount)



amayuresh
Creator III
Creator III

I think, this answer your question.

I have data like,

2.PNG

with Output as,

1.PNG

Dimension:

Prod_Run_No, Prod_Class

Expression:

Total=sum(FPlnnerCount)

Sub Total=Sum(TOTAL <Prod_Run_No> FPInnerCount)

% of Sub Total=sum(FPInnerCount)/Sum(TOTAL <Prod_Run_No> FPInnerCount)

Presentation Tab:

Checked "Show Partial Sums" for Dimension Prod_Class

stig1984
Creator II
Creator II
Author

Sorry, should have been clearer.

It is each run I need to run the calculation on, not just 200052.  I need somehow to reference the production run number for every run to get the total inner count and use the inner count for just the waste to calculate the percentage for every run.

stig1984
Creator II
Creator II
Author

many thanks

stig1984
Creator II
Creator II
Author

Even Better -

If I do sum(FPInnerCount) / sum( {1} <Prod_Run_No> FPInnerCount) then the percenatge calculation doesn't change even if I make a selection on Prod_Class.

Thanks for all your help - my forehead can now have a rest from banging it on a brick wall.