Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
swapnilgupta
Contributor
Contributor

number of units sold

Hello,

i want to calculate the number of units sold per week for current and last year.

='Current Year:' & Num(Sum({<[Trading Week End Date] = {'$(=Year(Today()))'}>} RTL_QTY)/Count(DISTINCT( TRDNG_WK_END_DT)), '##.00')
&
' Last Year:' & Num(Sum({<[Trading Week End Date] = {'$(=Year(Today())-1)'}>} RTL_QTY)/Count(DISTINCT( TRDNG_WK_END_DT)), '##.00')

 

this is the code i'm using, the values are coming up to be zero. can someone help me out on this

2 Replies
zhadrakas
Specialist II
Specialist II

hey,

you are comparing a date vs. a year

[Trading Week End Date] = {"$(=Year(Today()))"}

maybe you want to create that year field in script like

year( [Trading Week End Date] ) as Year_Trading

 then you could do this

'Current Year:' & Num(Sum({<Year_Trading = {'$(=Year(Today()))'}>} RTL_QTY)/Count(DISTINCT( TRDNG_WK_END_DT)), '##.00')
Brett_Bleess
Former Employee
Former Employee

Did the post you received help you get things working?  If so, be sure to return to the thread and use the Accept as Solution button on that post to give the poster credit for the assistance as well as let the other Community Members know what worked.  If you are still trying to sort things out, leave an update comment.

The only thing I can offer that may be of some help is the following:

https://community.qlik.com/t5/Qlik-Design-Blog/A-Primer-on-Set-Analysis/ba-p/1468344

That covers multiple topics as there are some related blog post links at the bottom of that post...

Here is the base URL for the Design Blog area in case you want to search yourself:

https://community.qlik.com/t5/Qlik-Design-Blog/bg-p/qlik-design-blog

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.