Skip to main content
Announcements
Have questions about Qlik Connect? Join us live on April 10th, at 11 AM ET: SIGN UP NOW
cancel
Showing results for 
Search instead for 
Did you mean: 
Saro_2306
Contributor II
Contributor II

Expression inside YTD formula

Hi all,

I need to show YTD values for Production / Working days for various Weeks in bar chart. 

Currently using this formula 

=sum({ < [WEEK NUM] = {">=$(=Yearstart(Max([WEEK NUM]))) <=$(=Max([WEEK NUM]))"}>} [PRODUCTION UNITS] ) /

Count({ < [WEEK NUM] = {">=$(=Yearstart(Max([WEEK NUM]))) <=$(=Max([WEEK NUM]))"}>} DISTINCT COMBINE1)
 
WEEK NUMProduction UnitsWorking DaysProduction / DaysYTD (it Shows)YTD (I Need)
1118.1259.0559.0559.05
2304.87560.97460.42120.024
3309.59561.91861.05181.942
4223.23455.807559.74237.7495
5237.46547.49256.82285.2415
6205.53541.10653.8326.3475

 

Any one help me to rewrite formula. Thanks in advance.

Labels (2)
6 Replies
Kushal_Chawda

@Saro_2306  you are using yearstart over WEEK_NUM which is not valid. You need a Date field for that because here week_num is in number format. 

In which format you want your end results? I mean which chart with Dimensions and measures

 

Saro_2306
Contributor II
Contributor II
Author

I Need results in Bar Chart. Weeknum is derived from Data using Week() formula in script.

benvatvandata
Partner - Creator II
Partner - Creator II

Maybe try:

=sum({ < [WEEK NUM] = {">=$(=Week(Yearstart(Max([WEEK NUM])))) <=$(=Max([WEEK NUM]))"}>} [PRODUCTION UNITS] ) /

Count({ < [WEEK NUM] = {">=$(=Week(Yearstart(Max([WEEK NUM])))) <=$(=Max([WEEK NUM]))"}>} DISTINCT COMBINE1)
Saro_2306
Contributor II
Contributor II
Author

No, its not working

Saro_2306
Contributor II
Contributor II
Author

Hi all,

 

Can we use like below.? is there any alternative for this.?

=sum({ < [WEEK NUM] = {">=$(=Yearstart(Max([WEEK NUM]))) <=$(=Max([WEEK NUM]))"}>} [PRODUCTION UNITS] / Count(DISTINCT COMBINE1) )

Brett_Bleess
Former Employee
Former Employee

Best I can offer is the following Design Blog post that may give you some ideas:

https://community.qlik.com/t5/Qlik-Design-Blog/Year-over-Year-Comparisons/ba-p/1462927

If you want to search further in that area, use the following link:

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.