Skip to main content
Woohoo! Qlik Community has won “Best in Class Community” in the 2024 Khoros Kudos awards!
Announcements
Nov. 20th, Qlik Insider - Lakehouses: Driving the Future of Data & AI - PICK A SESSION
cancel
Showing results for 
Search instead for 
Did you mean: 
jadams123
Creator
Creator

Question

This may have a solution or may not...

I have selected 2017 and weeks 1-46

my current week code is (This code is showing the correct amount😞

=Sum( {$<YEAR = {$(#=Max(YEAR))}, [Week No]= {$(#=Max([Week No]))}, CUSTOMER_TYPE -= {XYZ}, CREDIT_CODE_FLAG = {YES}>} AMOUNT )

My Previous Week code is (This code is not working. Its showing Current Weeks data) :

=Sum( {$<YEAR = {$(#=Max(YEAR)-1)}, [Week No]= {$(#=Max([Week No]))}, CUSTOMER_TYPE -= {XYZ}, CREDIT_CODE_FLAG = {YES}>} AMOUNT )

Is there any way to make this code work? So it shows previous weeks data.

I tried selecting 2017 and 2016 but the number for current week is a different amount. Its as if its taking 2017 current week amount + 2016 week 52 amount. Havent verified this amount.

That's what my IT dept told me....

 

if you don’t select a year, month no. or week no. and use max(year), max(week) you will get:

 

  • Year = 2017
  • Month No = 12
  • Week = 52

  

Thanks,

J

6 Replies
sunny_talwar

Would you be able to share a sample to look at?

fkeuroglian
Partner - Master
Partner - Master

Hi Joe

Please can you attached the example to be easier to help you?

Thanks

Fernando K.

jadams123
Creator
Creator
Author

I am just a front end user...I don't know what kind of example I should give other then sample data.

The data will be 2016 2017 sales. but selecting 2017 and weeks 1-46 in input box.

There is a typo in my question

Is there any way to make this code work? So it shows previous years data.

jadams123
Creator
Creator
Author

I solved it..by trial and error.

I was using this:

YEAR = {$(#=Max(YEAR))},

but if I use this it works...

Year = {$(=Max(Year))}

don't know why...but it works...

oscar_ortiz
Partner - Specialist
Partner - Specialist

Field names are case sensitive.

Is that the issue you were experiencing? 

Or was it the fact that you were using the "#"?

jadams123
Creator
Creator
Author

I think it was because of year...