Skip to main content
Announcements
Qlik Connect 2025: 3 days of full immersion in data, analytics, and AI. May 13-15 | Orlando, FL: Learn More
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

How to Count Distinct Visits Once in a Month to month

Hi,

I need to calculate visits a Guy made to you in a Month to month.

E.g

If i visit you 20 times in a Month the answer should be 1 visit, and in a year it should be 12 visits

Please advise, herewith my Script.

=sum(aggr(count(DISTINCT Date),CustomerCode,Date))- sum(aggr(count(DISTINCT Date),CustomerCode,Date))+1

Regards.

8 Replies
jonathandienst
Partner - Champion III
Partner - Champion III

In a table with month as a dimension, you just need

     Count(DISTINCT CustomerCode)

Or have I not properly understood your requirement?

Jonathan

Logic will get you from a to b. Imagination will take you everywhere. - A Einstein
pokassov
Specialist
Specialist

Hi!

= sum(aggr(count( distinct MonthName(Date)), CustomerCode ))

Not applicable
Author

Hi Jonathan,

you haven't Understood my Requirement

Not applicable
Author

Hi,

Your expression Disable all my Values and Shows nothing on my Straight Table.

PrashantSangle

Hi,

try

Aggr(Count(distinct CustomerCode),MonthName(Date))

Create MonthYear field which will make easier to write code

Regards

Great dreamer's dreams never fulfilled, they are always transcended.
Please appreciate our Qlik community members by giving Kudos for sharing their time for your query. If your query is answered, please mark the topic as resolved 🙂
awhitfield
Partner - Champion
Partner - Champion

Hi Thabiso,

check out the attached for some pointers: !

rubenmarin

Agree with max dreamer, just to comment that the Aggr() should be inside a Sum(), if you use MonthYear fields as suggested it can be:

Sum(Aggr(Count(distinct CustomerCode), MonthYear))

Not applicable
Author

Hi,

i got it covered i just putted the Month Column, then it worked like a Magic.

Thank you all, you'r e the best in Support.