Skip to main content
Announcements
Introducing Qlik Answers: A plug-and-play, Generative AI powered RAG solution. READ ALL ABOUT IT!
cancel
Showing results for 
Search instead for 
Did you mean: 
squalitooo
Contributor II
Contributor II

Aggregation problem

Hello,

I have a problem with the sum of 2 differents datas on the same item

My exemple:

ITEM | UNIT | FORMULA

ITEM_1 | KG | 25914

ITEM_1| UP| 418065

why when i try to sum this on ITEM with this formula :

If (Unite_Stock_Suivi_Fabrication='KG',Sum( Quantite_Suivi_Fabrication), Sum( Quantite_Suivi_Fabrication)*Poids_Article)

the result is 806775

the correct result would be : 418065 + 25914 = 443979

 

anyone can help me plz?

Labels (2)
1 Solution

Accepted Solutions
MarcoWedel

Hi,

If there is more than one unit per Article (i.e. when your pivot table is collapsed) then the If condition does not behave like you seem to expect.
I guess you are looking for something like this instead:

Sum(If(Unite_Stock_Suivi_Fabrication='KG', Quantite_Suivi_Fabrication, Quantite_Suivi_Fabrication*Poids_Article))

hope this helps

Marco

 

View solution in original post

2 Replies
MarcoWedel

Hi,

If there is more than one unit per Article (i.e. when your pivot table is collapsed) then the If condition does not behave like you seem to expect.
I guess you are looking for something like this instead:

Sum(If(Unite_Stock_Suivi_Fabrication='KG', Quantite_Suivi_Fabrication, Quantite_Suivi_Fabrication*Poids_Article))

hope this helps

Marco

 

squalitooo
Contributor II
Contributor II
Author

You're my hero it's works perfectly thanks for the help