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

Last Weeks value in pivot table with Month/Week

Dear all

I want to create a measure that gives me the inventory value with following dimensions in a pivot table. 

Top Dimension:YearMonth,YearWeek

Measure:Inventory for the week. 

Not a problem for the week but for the Month Total I want to display the max week for that months value. I have tried with Last, Max, IF statement etc but cant figure it out. 

Any suggestions? MaxWeek Inventory is the desired result.

Year Month Base (SCM)20M0120M02
Year Week Base (SCM)Total20W0120W0220W0320W0420W05Total20W0620W0720W0820W09
Inventory107 65521 43020 95721 31321 74222 21389 29422 37822 82421 33122 761
MaxWeek20W0520W0120W0220W0320W0420W0520W0920W0620W0720W0820W09
            
MaxWeek Inventory22 21321 43020 95721 31321 74222 21322 76122 37822 82421 33122 761

 

 

Labels (3)
3 Replies
edwin
Master II
Master II

the last week of the month will not change.  i suggest in your data model add a flag for the last week and use that flag in your expression.  that will be easier than a complex expression

christian_hallq
Partner - Contributor II
Partner - Contributor II
Author

Hi Edwin, 

The desired solution is a pivot table with first months and then weeks. I want a total on Weeks which should be the max weeks value of the month. How would a flag work? I understand the concept of flagging the last week of the month but how will I use that just for the total function of the weeks for the month?

 

Thanks

edwin
Master II
Master II

The flag will allow you to create expressions targeting just the last weeks of the month; it will also give the ability to apply expressions for weeks that arent the last week of the month.  see attached