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

Announcements
Join us to spark ideas for how to put the latest capabilities into action. Register here!
cancel
Showing results for 
Search instead for 
Did you mean: 
sumeet-vaidya
Partner - Creator
Partner - Creator

Aggr on mulitple Dimensions

Dear All,

I have a scenario wherein I want to calculate Repeat cases based on (PolicyNo+Subtype+MonthYear)

Secenario 1 :    

PolicyNoSubtypeDateMonth-Year
100ABC5/1/2017May-17
100ABC5/1/2017May-17
100ABC5/4/2017May-17
100ABC5/6/2017May-17
100ABC5/6/2017May-17
100ABC5/7/2017May-17

Output  

Month-YearRepeat Count
May-173

Scenario 2:    

PolicyNoSubtypeDateMonth-Year
100ABC5/1/2017May-17
100XYV5/1/2017May-17
100PQR5/4/2017May-17

Output  

Month-YearRepeat Count
May-170

Scenario 3:    

PolicyNoSubtypeDateMonth-Year
100ABC5/1/2017May-17
100ABC5/1/2017May-17
100PQR5/4/2017May-17

Output  

Month-YearRepeat Count
May-170

Awaiting your reply.

Regards

Sumeet

1 Solution

Accepted Solutions
sunny_talwar

Seems to be working for me

Case 1

Capture.PNG

Case 2

Capture.PNG

One thing I had change was change the field name Subtype to SubType. Notice the upper case T? QlikView is case sensitive and you need to make sure that you use the correct casing in the field name

View solution in original post

10 Replies
YoussefBelloum
Champion
Champion

Hi,

What is the repeat count ? and how did you calculate it on the first scenario ?

sumeet-vaidya
Partner - Creator
Partner - Creator
Author

Hi,

Repeat Count is Count(PolicyNo+Subtypes+MonthYear).

If a PolicyNo has multiple entries on the same Date, then it wont be considered as repeat.


In Scenario 1 :

Count 1 = 100+ ABC+5/1/2017

Count 2 = 100+ABC+5/4/2017

Count 3 = 100+ABC+6/4/2017

Count 4 = 100+ABC+7/4/2017


If the policy count is 4, then it is been repeated thrice so the Repeat Count = 3


Regards

Sumeet

YoussefBelloum
Champion
Champion

Sorry, I'm seeing this:

screen.png

sumeet-vaidya
Partner - Creator
Partner - Creator
Author

Hi,

You are seeing it perfectly just that we would be subtracting 1 from whatever would be the count of unique records.

For Eg. When the Policy comes for the 1st time, it is Unique but when it comes 2nd time then it is repeated once, when it comes 3rd time then it is repeated twice and so on.

hope this helps

Regards

Sumeet

YoussefBelloum
Champion
Champion

So if you had this

screen.png

in this case you will have only 4 records because you don't count the first one ?

sumeet-vaidya
Partner - Creator
Partner - Creator
Author

Hi,

MonthYear is based on Date. You have mentioned Oct date in front of May-2017.

If I had above scenario with Date as 5/8/2017 then Repeat Count = 4

Regards

Sumeet

sunny_talwar

Try this

Count(DISTINCT PolicyNo&Subtype&Date&[Month-Year]) - Count(DISTINCT PolicyNo&Subtype&[Month-Year])

sumeet-vaidya
Partner - Creator
Partner - Creator
Author

Hi,

Thanks for your reply stalwar1

But, This expression in not working for below cases.

Case 1 : Repeat Count = 2.

PolicyNo SubType MthYr1 Date
001ABCApr-20174/1/2017
001ABCApr-20174/18/2017
001ABCApr-20174/28/2017
001PQRApr-20174/25/2017

Case 2 : Repeat Count = 0

PolicyNo SubType Recvd_MthYr1 Date
001ABCApr-20174/22/2017
001PQRApr-20174/18/2017

Regards

Sumeet

sunny_talwar

Seems to be working for me

Case 1

Capture.PNG

Case 2

Capture.PNG

One thing I had change was change the field name Subtype to SubType. Notice the upper case T? QlikView is case sensitive and you need to make sure that you use the correct casing in the field name