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

Announcements
ALERT: QlikView server communication interruptions following Microsoft Windows Domain Controller security updates
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Sum month by month

Hello,

I would like calcule in simple table, electricity production month by month in the last column (Prod. MONTH SOD) for each town.

I've created the following expression with set analysis, to calculate the last column but it does not works

=sum({1<cent_nom=, pc_date_text = {"<=$(monthend(pc_date_text))"}>} cdd_production)

The good answer for the third line of Toulouse, will be 0 + 34 570 + 34 879 = 69 449 not 34 879

Central|Month|SOD|Prod. TOT SOD|Production MONTH|Month Rate|Prod. MONTH SOD
TOULOUSEavr. 201108/04/2011261 685  kWh0 kWh0,00%0 kWh
TOULOUSEmai 201108/04/2011261 685  kWh34 570  kWh12,71%34 570  kWh
TOULOUSEjuin 201108/04/2011261 685  kWh34 879  kWh12,83%34 879  kWh
TOULOUSEjuil. 201108/04/2011261 685  kWh36 682  kWh13,49%36 682  kWh
TOULOUSEaoût 201108/04/2011261 685  kWh38 348  kWh14,10%38 348  kWh
TOULOUSEsept. 201108/04/2011261 685  kWh33 946  kWh12,48%33 946  kWh
TOULOUSEoct. 201108/04/2011261 685  kWh29 115  kWh10,71%29 115  kWh
TOULOUSEnov. 201108/04/2011261 685  kWh15 018  kWh5,52%15 018  kWh
TOULOUSEdéc. 201108/04/2011261 685  kWh12 kWh0,00%12 kWh
PARISfévr. 201128/07/2010200 981  kWh0 kWh0,00%0 kWh
PARISmars 201128/07/2010200 981  kWh0 kWh0,00%0 kWh
PARISavr. 201128/07/2010200 981  kWh0 kWh0,00%0 kWh
PARISmai 201128/07/2010200 981  kWh13 915  kWh12,25%13 915  kWh
PARISjuin 201128/07/2010200 981  kWh15 090  kWh13,28%15 090  kWh
PARISjuil. 201128/07/2010200 981  kWh16 333  kWh14,38%16 333  kWh
PARISaoût 201128/07/2010200 981  kWh16 095  kWh14,17%16 095  kWh
PARISsept. 201128/07/2010200 981  kWh14 019  kWh12,34%14 019  kWh
PARISoct. 201128/07/2010200 981  kWh12 583  kWh11,07%12 583  kWh
PARISnov. 201128/07/2010200 981  kWh6 697 kWh5,89%6 697 kWh
PARISdéc. 201128/07/2010200 981  kWh671 kWh0,59%671 kWh
LYONaoût 201121/06/2011120 104  kWh6 314 kWh2,92%6 314 kWh
LYONsept. 201121/06/2011120 104  kWh25 549  kWh11,81%25 549  kWh
LYONoct. 201121/06/2011120 104  kWh16 981  kWh7,85%16 981  kWh
LYONnov. 201121/06/2011120 104  kWh6 250 kWh2,89%6 250 kWh
LYONdéc. 201121/06/2011120 104  kWh859 kWh0,40%859 kWh

Thanks you

Labels (1)
7 Replies
pover
Partner - Master
Partner - Master

You can't use set analysis to accumulate over a field that is also the object's dimension.  In this case, you can try to inter-row function like

rangesum(above(sum(cdd_production),0,12))

or a method called a "asof" table, or in some cases, an island table.

Karl

Not applicable
Author

Hello Karl

Thanks for your answer, but the rangesum(above()) can't works because user must be able to sort the table as they want, as you can see in the following chart.

CentralMonthSODProd TOT SODProduction MONTHMonth RateProd. MONTH SOD
PARISfévr. 201128/07/2010200 981  kWh0 kWh0,00%0 kWh
PARISmars 201128/07/2010200 981  kWh0 kWh0,00%0 kWh
TOULOUSEavr. 201108/04/2011261 685  kWh0 kWh0,00%0 kWh
PARISavr. 201128/07/2010200 981  kWh0 kWh0,00%0 kWh
TOULOUSEmai 201108/04/2011261 685  kWh34 570  kWh12,71%34 570  kWh
PARISmai 201128/07/2010200 981  kWh13 915  kWh12,25%83 055  kWh
TOULOUSEjuin 201108/04/2011261 685  kWh34 879  kWh12,83%34 879  kWh
PARISjuin 201128/07/2010200 981  kWh15 090  kWh13,28%84 848  kWh
TOULOUSEjuil. 201108/04/2011261 685  kWh36 682  kWh13,49%36 682  kWh
PARISjuil. 201128/07/2010200 981  kWh16 333  kWh14,38%89 697  kWh
TOULOUSEaoût 201108/04/2011261 685  kWh38 348  kWh14,10%38 348  kWh
PARISaoût 201128/07/2010200 981  kWh16 095  kWh14,17%92 791  kWh
LYONaoût 201121/06/2011120 104  kWh6 314 kWh2,92%153 548  kWh
TOULOUSEsept. 201108/04/2011261 685  kWh33 946  kWh12,48%33 946  kWh
PARISsept. 201128/07/2010200 981  kWh14 019  kWh12,34%81 911  kWh
LYONsept. 201121/06/2011120 104  kWh25 549  kWh11,81%155 425  kWh
TOULOUSEoct. 201108/04/2011261 685  kWh29 115  kWh10,71%29 115  kWh
PARISoct. 201128/07/2010200 981  kWh12 583  kWh11,07%70 813  kWh
LYONoct. 201121/06/2011120 104  kWh16 981  kWh7,85%129 492  kWh
TOULOUSEnov. 201108/04/2011261 685  kWh15 018  kWh5,52%15 018  kWh
PARISnov. 201128/07/2010200 981  kWh6 697 kWh5,89%36 733  kWh
LYONnov. 201121/06/2011120 104  kWh6 250 kWh2,89%64 698  kWh
TOULOUSEdéc. 201108/04/2011261 685  kWh12 kWh0,00%12 kWh
PARISdéc. 201128/07/2010200 981  kWh671 kWh0,59%695 kWh
LYONdéc. 201121/06/2011120 104  kWh859 kWh0,40%2 237 kWh

Thanks

jagan
Partner - Champion III
Partner - Champion III

Hi,

Try this expression

=rangesum(Above(total sum(production),0,RowNo(total)))

Regards,

Jagan.

Not applicable
Author

Hello Jagan,

That bypass the Central dimession and perform a sum of all production's month

Regards

pover
Partner - Master
Partner - Master

You're going to have to do it with a "asof" table.  I've attached an example.

Karl

Not applicable
Author

Thanks Karl for your exemple.

I've created the following expression based on the field pc_monthyear_text_asof stored in ProductionCalendarAsOf dimension table, and the field pc_monthyear_text is in ProductionCalendar table.

=sum({1<cent_nom=, pc_monthyear_text = {"<=$(max(pc_monthyear_text_asof))"}>} cdd_production)

I still have the same result, the sum of the month and i don't use the field that is used in the dimension ( pc_date_text ). Something missing me

Regards

pover
Partner - Master
Partner - Master

If the asof table to correctly made you don't have to try to do any accumulated set analysis. 

You should use the field pc_monthyear_text_asof as your dimension and then the formula for the accumlated production should be

=sum({$<cent_nom=>} cdd_production)

and the formula for the montly production should be

=sum({$<cent_nom=>} if(pc_monthyear_text_asof = pc_monthyear_text, cdd_production))

Give it a try and tell us if that works.

Karl