Skip to main content
Announcements
Have questions about Qlik Connect? Join us live on April 10th, at 11 AM ET: SIGN UP NOW
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Calculation problem

Hi everyone,

I came across a quiet weird problem. I posted a picture so you should look at it I have a min Date to every product and I try to calculate now how many pieces I had in stock on the min date of my product. so the product 712486 I had in stock on the 05.06.2012 in stock the first time and I had 10 piece of it. so my second product 726751 I had in stock the first time on the 30.10.2012 so far so good but QV still calculates the pieces i had in stock for the 05.05.2012 but I want it for 30.10.2012. Can anyone help me to fix this pivot table??

regards,

MT

6 Replies
thanstad
Creator
Creator

What if you make a simple set analysis as two separate expressions

 

=sum({$<Period={$(=MIN(Period))}>} Menge)

AND

=sum({$<Period={$(=MAX(Period))}>} Menge )

Tormod Hanstad

Not applicable
Author

If you looked at the picture I posted if I do the set analysis sum({<min(...)>}MENGE) it only calculates the stock right for the product we got delivered first. so the pivot table doesnt use the min(date) for each row right in the set analysis

Gysbert_Wassenaar

The set analysis expression calculates one set for the entire chart, not a set per row. Perhaps the firstsortedvalue can be used: firstsortedvalue(MENGE, DATUM)


talk is cheap, supply exceeds demand
Anonymous
Not applicable
Author

Magdalena,

Either try the suggestion from GW, or create a field in the data model:

min(Datum) as FirstOrderDatePerProduct

Regards,

Michael

Not applicable
Author

hi,

thanks for the quick response but all you suggestions didn't work because also when I save the firstoderdateperproduct i still come across the same issue. because every produkt has a different FirstOrderDatePerProduct. i am using now this in my set analysis or did I understand something wrong?

regards,

MT

Anonymous
Not applicable
Author

It is expected that each Product has its own FirstOrderDatePerProduct.  The expression in your table probably should be:
sum(if(FirstOrderDatePerProduct=DATUM, MENGE))
But I could be wrong without knowing what the data is about and what MENGE means.  In this case the problem is not with the pivot table but in the overall data model design.

Regards,
Michael