Skip to main content
Announcements
Qlik Introduces a New Era of Visualization! READ ALL ABOUT IT
cancel
Showing results for 
Search instead for 
Did you mean: 
Applicable88
Creator III
Creator III

Only sum a field when its the month of today

Hello,

I have following table:

Date Productive DaysRevenue
11.09.202011215
12.09.202011215
13.09.202018555
05.10.202012564
06.10.202015874
07.10.202019652
08.10.202017423
09.10.202013652
10.10.202018545

 

The date field is formatted as date.  

Now I only want to sum the productive dates (non vacation days) always of the current month. 

If I need an KPI window to show me all working days of the current month I tried to use this expression:

sum(if(num(year(Date)) & Num(Month(Date)) = num(year(today())) & num(month(today))) Productive Days)

So basically I'm converting all the date values and also the current month and year values into a number. It works pretty well when I do it separtely in another kpi window, each function for itself. But after putting them all together it doesn't return me the  sum of all Productive days where the condition is actually met. 

Have someone an idea whats the problem here, or is there a better way to express what I'm looking for?

Thanks in advance. 

 

 

 

2 Solutions

Accepted Solutions
Taoufiq_Zarra

@Applicable88  are you looking for ?

=Sum({$<Date={"= (Year(Date) = year(today()) and Month(Date) = Month(today())) "}>}[Productive Days])

 

Capture.PNG

Regards,
Taoufiq ZARRA

"Please LIKE posts and "Accept as Solution" if the provided solution is helpful "

(you can mark up to 3 "solutions") 😉

View solution in original post

Kushal_Chawda

@Applicable88  try below

=Sum({$<Date={">=$(=date(monthstart(today())))<=$(=date(monthend(today()))))"}>}[Productive Days])

View solution in original post

5 Replies
Taoufiq_Zarra

@Applicable88  are you looking for ?

=Sum({$<Date={"= (Year(Date) = year(today()) and Month(Date) = Month(today())) "}>}[Productive Days])

 

Capture.PNG

Regards,
Taoufiq ZARRA

"Please LIKE posts and "Accept as Solution" if the provided solution is helpful "

(you can mark up to 3 "solutions") 😉
Kushal_Chawda

@Applicable88  try below

=Sum({$<Date={">=$(=date(monthstart(today())))<=$(=date(monthend(today()))))"}>}[Productive Days])
Applicable88
Creator III
Creator III
Author

@Taoufiq_Zarra as always great! 

Thx. 

Ari_vzla
Contributor III
Contributor III

Why this answer is not working for me? I am replaced Date and Productive Days with my fields but system show me an error

=Sum({$<[Tiempo extra 2020.Mes]={"= (Year(Date) = year(today()) and Month(Date) = Month(today())) "}>}[[Total Hrs Extras]])

I am trying to do the same. Instead Date  is Mes and instead productived days is otal Hrs Extras

Thank you 

Arieli

Applicable88
Creator III
Creator III
Author

Hi @Ari_vzla , 

your last [Total Hrs Extras] has to square brackets. If you remove one of them does it solve the problem?

Best.