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

Aggregate to sum on calendar with a specific field as key

I have some data linked by my Line_Date field to my calendar such as :

My data :

Header_Date Line_Date (as Calendar_Key) Data_Key
20240401 20240401 1
20240401 20240405 2
20240401 20240406 3
20240401 20240407 4

 

My Calendar :

Calendar_Key Worked_Day
<20240401 ~
20240401 1
20240402 1
20240403 1
20240404 1
20240405 1
20240406 0
20240407 0
20240408 1
20240409 1
20240410 1
20240411 1
20240412 1
20240413 0
20240414 0
20240415 1
>20240401 ~

 

I need to make an aggregate to sum the number of Worked_Day between today and the header date and not the line date. 

I closest i got was this but it only work if i have 1 data selected : 

Aggr(nodistinct Sum(
{1<
[Calendar_Key]={"$(= '>=' & Date(Aggr(nodistinct Min([Calendar_Key]),[Header Date])) & '<=' & Today() )"}
>} 
[Worked_Day])
,[Worked_Day])

 

Labels (3)
1 Solution

Accepted Solutions
Chanty4u
MVP
MVP

Try this 

Aggr(

    Sum({< [Calendar_Key] = {"$(='>=' & Date(Aggr(Min([Calendar_Key]), [Header_Date])) & '<=' & Today())"} >} [Worked_Day]),

    [Header_Date])

View solution in original post

1 Reply
Chanty4u
MVP
MVP

Try this 

Aggr(

    Sum({< [Calendar_Key] = {"$(='>=' & Date(Aggr(Min([Calendar_Key]), [Header_Date])) & '<=' & Today())"} >} [Worked_Day]),

    [Header_Date])