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: 
nguyenviethung
Contributor III
Contributor III

How to get Inventory by week from days

Hi folks,

Thanks for helping me in previous topics. Now i have another concern:

I got a inventory data table like this:

DATESTORESKUINVENTORY
1/1/2018Aa5
1/1/2018Ab2
1/1/2018Ac3
1/2/2018Aa6
1/2/2018Ab0
1/2/2018Ac5
1/3/2018Aa1
1/3/2018Ab2
1/3/2018Ac2
1/3/2018Ba2
1/3/2018Bb4
1/3/2018Bc8

Note: Some store have daily inventory data, some just have 1 day/week.

Now what i want is: Measuring inventory by SKU by Store by Week; like this:

WeekSTORESKUINVENTORY
1Aa1
1Ab2
1Ac2
1Ba2
1Bb4
1Bc8

which means:

  • if stores have only 1 day data in a week -> that day would be the inventory for that whole week
  • if stores have many day data in a week -> the latest day inventory will be that week final inventory

Can anyone tell me how to write the expression or load in script?

Thank you all.

8 Replies
ogautier62
Specialist II
Specialist II

Hi,

try something like this for inventory

if(date=max( date),inventory)

with(week, store, sku as dimension)

regards

nguyenviethung
Contributor III
Contributor III
Author

Yours sounds good but I dont know why it does not work, bro:

Capture.JPG

Could you pls revise it?

PrashantSangle

try this

sum({<DATE={"$(=max(DATE))"}>}INVENTORY)

Regards,

Great dreamer's dreams never fulfilled, they are always transcended.
Please appreciate our Qlik community members by giving Kudos for sharing their time for your query. If your query is answered, please mark the topic as resolved 🙂
PrashantSangle

or simply try

firstsortedvalue(INVENTORY,-DATE)

Regards

Great dreamer's dreams never fulfilled, they are always transcended.
Please appreciate our Qlik community members by giving Kudos for sharing their time for your query. If your query is answered, please mark the topic as resolved 🙂
nguyenviethung
Contributor III
Contributor III
Author

Bro, sounds good but none of the above works; could you pls double check it:

Capture.JPG

nguyenviethung
Contributor III
Contributor III
Author

Can anyone helppppp meeee? Thankssss.

Anil_Babu_Samineni

How about this?

Capture.png

302873:

LOAD * Inline [

DATE, STORE, SKU, INVENTORY

1/1/2018, A, a, 5

1/1/2018, A, b, 2

1/1/2018, A, c, 3

1/2/2018, A, a, 6

1/2/2018, A, b, 0

1/2/2018, A, c, 5

1/3/2018, A, a, 1

1/3/2018, A, b, 2

1/3/2018, A, c, 2

1/3/2018, B, a, 2

1/3/2018, B, b, 4

1/3/2018, B, c, 8

];

Right Join(302873)

LOAD Max(DATE) as DATE

Resident 302873;

Please add me Anil_Babu_Samineni to interact faster when reply back. Speak low think High.

Before develop something, think If placed (The Right information | To the right people | At the Right time | In the Right place | With the Right context)
nguyenviethung
Contributor III
Contributor III
Author

Thank you bro; but your solution seems to load only latest date data. What I want is weekly inventory; including history data.