Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
chriscools
Creator II

qlikview sees current week as 1 and not 53 giving a wrong total for the week invoicing

Hello,

 

i have this formula wich gives me the total invoiced amount for the current week:

=num(sum ( {< LegalEntity = {'Pomax Belgium'} ,InvoiceType={'Faktuur'}, Year = {'$(= Year( Today()))'},Week = {'$(= Week( Today()))'} >} InvoiceQty*InvoicePriceUnitNet),'#.###,##€')

 

Yesterday i saw that it was giving me an amount that was bigger than what was actually invoiced.

When i split up the formula in different pieces, i noticed that the piece returning the week gave me 1 as a result:

=Week = {'$(= Week( Today()))'} >}

So somehow Qlikview thinks that it is in week 1 for 2019 and not week 53.

Any idea on how this might be solved?

1 Solution

Accepted Solutions
tresesco
MVP

This is because your qv settings tells qlik to use unbroken weeks, hence your week starting here in Dec. To handle this set your system variable  broken_weeks to 1, i.e.- allow broken weeks. Like:

Capture.PNG

and of course don't forget to reload the application post modification of the script variable. Otherwise, you can use week function's third parameter to pass the same information.

week(timestamp [, first_week_day [, broken_weeks [, reference_day]]])

 

View solution in original post

3 Replies
Kushal_Chawda

It's giving me 53 only for week(today()).

May be try below expression

Week ={"$(=max(Week))"}

If you have data for future as well try below

Week ={"$(=max({<Year={'$(=year(today()))'}>}Week))"}

tresesco
MVP

This is because your qv settings tells qlik to use unbroken weeks, hence your week starting here in Dec. To handle this set your system variable  broken_weeks to 1, i.e.- allow broken weeks. Like:

Capture.PNG

and of course don't forget to reload the application post modification of the script variable. Otherwise, you can use week function's third parameter to pass the same information.

week(timestamp [, first_week_day [, broken_weeks [, reference_day]]])

 

Brett_Bleess
Former Employee

Just wanted to add the following Help link to coincide with Amit's post:

https://help.qlik.com/en-US/qlikview/April2019/Subsystems/Client/Content/QV_QlikView/Scripting/Numbe...

I have to admit I just learned something new off that one myself, which just goes to show there is always something new to figure out most days, thanks Amit!

If Amit's post does get things working, do not forget to use the Accept as Solution button on that post to mark it and give him credit for the help.  If you have further questions, shout back.

Regards,
Brett

To help users find verified answers, please do not forget to use the "Accept as Solution" button on any post(s) that helped you resolve your problem or question.
I now work a compressed schedule, Tuesday, Wednesday and Thursday, so those will be the days I will reply to any follow-up posts.