Skip to main content
Announcements
Qlik Connect 2024! Seize endless possibilities! LEARN MORE
cancel
Showing results for 
Search instead for 
Did you mean: 
roeibenishti
Contributor
Contributor

Do not accumulate in accumulative dimension

Hi All,

I have the following tables:

Time:

date2date
NOV-2017NOV-2017
DEC-2017NOV-2017
DEC-2017DEC-2017
JAN-2018NOV-2017
JAN-2018DEC-2017
JAN-2018JAN-2018

Data:

dateSalesInventory.Value
NOV-20171,00012,000
DEC-20171,50010,500
JAN-20182,0008,500

I'm using the date2 dimension in my pivot table so i'll get an accumulate sales result (I have to use this dimension since there are additional objects that use it and I cannot change them).

I'm trying to get the correct OB value for each one of the fields, but i'm only getting it accumulated.

What I'm trying to achive:

date2SalesInventory.Value
DEC-20172,50012,000
JAN-20184,50010,500

How can I sort it so Inventory.value will present the previous month inventory value while I'm using the date2 dimension?

Thank for helping

1 Solution

Accepted Solutions
sunny_talwar

Another way would be to create a flag in the script

Time:

LOAD *,

(Year(date2)*12 + Month(date2)) - (Year(date)*12 + Month(date)) as Difference;

LOAD Date#(date2, 'MMM-YYYY') as date2,

Date#(date, 'MMM-YYYY') as date;

LOAD * INLINE [

    date2, date

    NOV-2017, NOV-2017

    DEC-2017, NOV-2017

    DEC-2017, DEC-2017

    JAN-2018, NOV-2017

    JAN-2018, DEC-2017

    JAN-2018, JAN-2018

];

Data:

LOAD Date#(date, 'MMM-YYYY') as date,

Sales,

Inventory.Value;

LOAD * INLINE [

    date, Sales, Inventory.Value

    NOV-2017, "1,000", "12,000"

    DEC-2017, "1,500", "10,500"

    JAN-2018, "2,000", "8,500"

];

And then this

=Sum({<Difference = {1}>}Inventory.Value)


Capture.PNG

View solution in original post

3 Replies
petter
Partner - Champion III
Partner - Champion III

2017-12-06 00_02_45-QlikView x64 - [D__Downloads_# QC - 2017-12-05 Do not accumulate in accumulative.png

sunny_talwar

Another way would be to create a flag in the script

Time:

LOAD *,

(Year(date2)*12 + Month(date2)) - (Year(date)*12 + Month(date)) as Difference;

LOAD Date#(date2, 'MMM-YYYY') as date2,

Date#(date, 'MMM-YYYY') as date;

LOAD * INLINE [

    date2, date

    NOV-2017, NOV-2017

    DEC-2017, NOV-2017

    DEC-2017, DEC-2017

    JAN-2018, NOV-2017

    JAN-2018, DEC-2017

    JAN-2018, JAN-2018

];

Data:

LOAD Date#(date, 'MMM-YYYY') as date,

Sales,

Inventory.Value;

LOAD * INLINE [

    date, Sales, Inventory.Value

    NOV-2017, "1,000", "12,000"

    DEC-2017, "1,500", "10,500"

    JAN-2018, "2,000", "8,500"

];

And then this

=Sum({<Difference = {1}>}Inventory.Value)


Capture.PNG

roeibenishti
Contributor
Contributor
Author

Thanks a lot. Easy and simple idea