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

Announcements
See why IDC MarketScape names Qlik a 2025 Leader! Read more
cancel
Showing results for 
Search instead for 
Did you mean: 
HamJan
Contributor II
Contributor II

Count contracts that ended on yyyymm

I have table

|Contractid|StartDate|Endate|Duration|EndYearMonth|YYYYMM|

|1            | 2022-01-01|   2022-07-30  | 6   |   202207     |  202201   |

|1            | 2022-01-01|   2022-07-30  | 6   |   202207     |  202202   |

...

|1            | 2022-01-01|   2022-07-30  | 6   |   202207     |  202207   |

i want to make line graph that shows how many contracts that started 6 month ago ended on each month.
So example Contract would give count 0 on months 202201-202206 and 1 on 202207

I have tried with

Count({<[Duration]={'6'}, EndYearMonth={'YYYYMM'}>} DISTINCT ContractID)

But it does not work.

Labels (5)
4 Replies
Clement15
Partner - Specialist
Partner - Specialist

Hello,

Can you try with this:

 

sum(aggr(rangesum(above(count(distinct ContractID),0,6)),[YYYYMM]))

HamJan
Contributor II
Contributor II
Author

HamJan_0-1737715761928.png

Not correct. Should be 0 allway until 202207 and then 1

 

Clement15
Partner - Specialist
Partner - Specialist

Same with the rangesum? the rangecount was an error

Is your dimension in your chart YYYYMM? If not, you need to replace it with the dimension you are using.

Chanty4u
MVP
MVP

Try this 

Count({<EndYearMonth = {"=Date(AddMonths(Date#(YYYYMM, 'YYYYMM'), [Duration]) = EndYearMonth)"}>} DISTINCT ContractID)