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

Announcements
Qlik Connect 2026! Turn data into bold moves, April 13 -15: Learn More!
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Problem Sum

Hi,

I have a problem with Function "Sum"

I try to calculate "Stock UC a date" with this :

FirstSortedValue(aggr(DISTINCT Sum(Qte_UC_Stock_BDD)+ sum(Qte_PCU_STOJOU),Date_Mvt, Code_Article,Stat_2_Article),-aggr(Date_Mvt,Date_Mvt,Code_Article,Stat_2_Article ))

and

FirstSortedValue(aggr(DISTINCT Sum(Qte_UC_Stock_BDD)+ rangesum(Above(TOTAL (Sum(Qte_PCU_STOJOU)) , 0, RowNo())),Date_Mvt, Code_Article,Stat_2_Article),-aggr(Date_Mvt,Date_Mvt,Code_Article,Stat_2_Article ))

Capture.JPG

It's Ok for collapse or expand but my results is not good.

Normally subtract every operation of movement of the result obtained previously on "Stock UC a date"


Maybe anyone have an idea where is my problem?

1 Solution

Accepted Solutions
jolivares
Specialist
Specialist

I forget attach the sample QVW

View solution in original post

10 Replies
jolivares
Specialist
Specialist

Try to post a small sample with data and show what is your problem better, i can't see what is happening or what you really want.

Let me help you.

Not applicable
Author

a demo with my problem

Best regards

Not applicable
Author

i join a demo for explain my problem

Best regards

Not applicable
Author

anyone can help me ?

jolivares
Specialist
Specialist

You need to user dimensionality()

If(Dimensionality()>4,(Sum(StockAnterieur))+ rangesum(Above(TOTAL (Sum(Q_Mvt)) , 0, RowNo())),

FirstSortedValue(aggr(DISTINCT Sum(StockAnterieur)+ sum(Q_Mvt),Date_Mvt, Code_Article,Stat_2_Article),-aggr(Date_Mvt,Date_Mvt,Code_Article,Stat_2_Article )))

jolivares
Specialist
Specialist

Ups... I think this is the solution to your question.

Not applicable
Author

Hello,

Nor working, i have the same results.

when i expand my board on "date_Mvt" i found 1520 in QTY and is the good results;

but when i collapse to "Code_Article" or "Stat_2_Article" my results is not good i found 1910..

Thanks to the help

jolivares
Specialist
Specialist

Ok... Pascal, see the example below.  I just simply yours.

Capture.PNG

Capture.PNG

This is what you are looking for:

jolivares
Specialist
Specialist

I forget attach the sample QVW