Skip to main content
Announcements
Join us at Qlik Connect for 3 magical days of learning, networking,and inspiration! REGISTER TODAY and save!
cancel
Showing results for 
Search instead for 
Did you mean: 
MDC
Contributor
Contributor

How to find current week's corresponding value(count) from a datefield(G_Date) column?

I have 4 columns as below.
G_Date
2020-03-24 00:00:00:000000
2020-03-23 00:00:00:000000
2020-03-22 00:00:00:000000
2020-03-21 00:00:00:000000 
.
.and so on...

F_Week
52
51
50
49
.... and so on the for every year..

F_Year
2020
2020
2019
2018
... and so on...

Count
30
40
50
20
.... and so on

I need the count for the current week.
how do i calculate it? can it be achieved from 'G_Date' field?

 

4 Replies
Mauritz_SA
Partner - Specialist
Partner - Specialist

Hi @MDC 

I assume you want to Sum the counts for the current week. Then you can use the following expression:

Sum({<G_Date = {'=WeekName(Date#(Left(G_Date,10),''YYYY-MM-DD''))=Weekname(Today())'}>} Count)

Hope this helps.

Regards,

Mauritz

lorenzoconforti
Specialist II
Specialist II

What are you trying to count? The number of days in the current week?

 

MDC
Contributor
Contributor
Author

Sum of 'count' for the current week.

Mauritz_SA
Partner - Specialist
Partner - Specialist

Hi @MDC 

Did you try Sum({<G_Date = {'=WeekName(Date#(Left(G_Date,10),''YYYY-MM-DD''))=Weekname(Today())'}>} Count)?