Qlik Community

New to QlikView

Discussion board where members can get started with QlikView.

jadams123
Contributor

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

Re: Question

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

Highlighted
Partner
Partner

Re: Question

Hi Joe

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

Thanks

Fernando K.

jadams123
Contributor

Re: Question

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
Contributor

Re: Question

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...

Partner
Partner

Re: Question

Field names are case sensitive.

Is that the issue you were experiencing? 

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

jadams123
Contributor

Re: Question

I think it was because of year...