Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Join us in NYC Sept 4th for Qlik's AI Reality Tour! Register Now
cancel
Showing results for 
Search instead for 
Did you mean: 
Aspiring_Developer
Specialist
Specialist

Calculate YTD and QTD in Qlik using count

Hello All, 

I have below data comprising details about incidents:-

Aspiring_Developer_0-1726464359994.png

This month year is created in the backend script from the field -Incident Occurred Date

If I add date column in the above, my data would look like this :-

Aspiring_Developer_1-1726464460544.png

I want to achieve below :-

1) Calculate YTD by taking the count(ID) . In my data set the max of date is 2025 as I have the forecast dates but in this I just have the data values till max month and my data is starting from April 2023 and I want to to show it till max (month ) as of today . I tried below expression but it did not worked :-

Sum({<[Incident Occurred Date]={"<=$(=Date(Today(), 'MM/DD/YYYY'))"}>} [Count(ID)]) 

This gives -Error in expression 

2) I also want to show MTD, QoQ for the above in the KPI and and in the form of line chart 

My expression should take the count of ID and not sum because when I take the sum, it gives me a lot of values:-

Aspiring_Developer_0-1726464943368.png

 

How can I achieve this?

@Kushal_Chawda  

 

Labels (2)
1 Solution

Accepted Solutions
Kushal_Chawda

@Aspiring_Developer  try below

 

Count({<[Incident Occurred Date]={"<=$(=Date(Today()))"}>} ID) 

or

Count(distinct {<[Incident Occurred Date]={"<=$(=Date(Today()))"}>} ID) 

View solution in original post

2 Replies
diagonjope
Partner - Creator III
Partner - Creator III

Hi @Kushal_Chawda !

Try this:

Sum({< [Incident Occurred Date]={"<=$(=date(Today(1), 'MM/DD/YYYY'))"} >}  [Count(ID)]) 

Cheers,

++José

Kushal_Chawda

@Aspiring_Developer  try below

 

Count({<[Incident Occurred Date]={"<=$(=Date(Today()))"}>} ID) 

or

Count(distinct {<[Incident Occurred Date]={"<=$(=Date(Today()))"}>} ID)