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

Announcements
Independent validation for trusted, AI-ready data integration. See why IDC named Qlik a Leader: Read the Excerpt!
cancel
Showing results for 
Search instead for 
Did you mean: 
timmy
Partner - Contributor III
Partner - Contributor III

Accumulation in script

Hey

Underneed you can see my code where i try to accumulate Consommé_CONSO

SO the Consommé needs to be accumulated bases on the month(Mois de conso_MONTH_CONSO) and the Post Budg Int Numb_POSTBUDG

Directory;

test:





LOAD





%KEY_ZCONSOMMATION_ANBUD_TBUDGET,
Nr_ORG,
[Mois de conso_MONTH_CONSO],
[Post Budg Int Numb_POSTBUDG],
Consommé_CONSO

FROM

[Brussels Gewest\QlikViewStorage\Private Files\Data\ZCONSOMMATION.QVD]

(

qvd)



;



noconcatenate

tmp:
load
*
resident



test
order by [Post Budg Int Numb_POSTBUDG] asc,[Mois de conso_MONTH_CONSO]

asc;



drop

table

test;



Load

[Post Budg Int Numb_POSTBUDG],
[Mois de conso_MONTH_CONSO],
Consommé_CONSO,
if( ISNUll(peek(Consommé_CONSO)),Consommé_CONSO,Consommé_CONSO+peek(accum)) as
accum
resident
tmp order by [Mois de conso_MONTH_CONSO]

asc;

drop

table

tmp;







1 Reply
Not applicable

Hi,

The function ISNULL() return -1 for true and 0 for false, maybe you need to check the condition:

IF( ISNULL(....) = -1, Do....., Else....)