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: 
tomf122
Contributor III
Contributor III

Aggregation in a If statement

I am having trouble when trying to create a measure in a pivot table. It has three demensions being PU, RR_constraint then material_no. 

This formula works for me when looking at the material_no layer in the pivot table but when i collaspe it .to view at the RR_constraint level the values dont add up as i beileve the if is being performed at that level.
if(
sum(Finish_Plan) = 0, sum(Finish_Plan),sum(Actuals_Countable)
)

 

I tried aggregating it like below at a material_no level and even include the RR_constraint field but again it showing correct values at material_no but when trying to view at the next level 0 is showing. Any idea how i could go about adjusting. I have tried multiple different ways but cant get to work. Data is basic with material_no being a varchar and others fields being decimals. 

if(
aggr(sum(Finish_Plan),material_no) = 0, aggr(sum(Finish_Plan),material_no),aggr(sum(Actuals_Countable),material_no)
)

 

Labels (2)
1 Reply
Antoine04
Partner - Creator III
Partner - Creator III

Hello,

Try to add all the fields in your aggr. formula, maybe something like :

aggr(sum(Finish_Plan),PU, RR_constraint, material_no)

Could you share a screen of your exemple ? That would help.

Regards,

Antoine