Skip to main content
Announcements
Qlik Connect 2024! Seize endless possibilities! LEARN MORE
cancel
Showing results for 
Search instead for 
Did you mean: 
beck_bakytbek
Master
Master

Difference in Week

Hi Folks,

i hope you are all well. i got a question and i am struggling at the same time with one issue:

I have the following table:

Project, WeekYear

A1, 1 -2018

A, 49- 2019

My issue is, how can i show the difference between WeekYear: 1 - 2018 and WeekYear: 49 - 2019, I tried to solve it by using the expression: Round((max(WeekYear)-min(WeekYear))/7), but i didn't achieve any results.

 

Does anybode have any idea, how to solve this issue?

Thanks a lot for any help and feedbacks

Bek

Labels (1)
5 Replies
Martijn_W
Contributor III
Contributor III

Hi there,

It looks as though your datefields aren't properly formatted.

Is the original data aggregated like this?

beck_bakytbek
Master
Master
Author

Hi Martin, thanks a lot for your reply, yes, the original data are aggregated like this, Do you have any idea how to solve this issue?

Thanks a lot for your help and time

Martijn_W
Contributor III
Contributor III

=MakeWeekDate(right(WeekYear,4), purgechar(left(WeekYear,2),'-')) to get the proper format.

Then you could use functions like weekstart to get the date. after that, substract the two dates and divide by seven. That should do the trick.

Martijn_W
Contributor III
Contributor III

I would solve this problem in the script first though, I would use

weekstart(MakeWeekDate(right(WeekYear,4), purgechar(left(WeekYear,2),'-'))) as WeekStart

to mend the date fields and then use

round((max(WeekStart)-Min(WeekStart)/7)

in the chart expression.

Martijn_W_0-1604944963364.png

 

Martijn_W_1-1604944993119.png

 

beck_bakytbek
Master
Master
Author

Good Morning Martijn, first of all, thanks a lor for your time and valuable time,

i try to implement it, when i have achieved a solution, i will immediately report you.

Thanks a lot

Bek