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

Announcements
Independent validation for trusted, AI-ready data integration. See why IDC named Qlik a Leader: Read the Excerpt!
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

How to make Unique Number?

Hi Experts,

i have a request that i have to get the Unique Numbers from given numbers

Sample Given Table:

IdMonthsNamesVisits
0021JANJack340
9045JANJohn248
4561JANLeslie3

OUTPUT:

IdMonthsHeader 3VisitsUnique Visits
JANJack3401
JANJohn2481
JANLeslie31

So each Month Unique Visits Increments by 1

E.g JAN = 1

     FEB = 1

     MAR = 1

     APR = 1

and so on, so in a year it should be 12 Visits.

16 Replies
Peter_Cammaert
Partner - Champion III
Partner - Champion III

I think I get it. You want the number of unique visits per month for all selected months?

Then how about:

=sum(aggr(count(DISTINCT CustomerCodeName), SalesMonth))

Not applicable
Author

Yes,

How can i Tackle it, so that every month is equal to 1 if there's Visit if not make it Zero.

Regards.

Peter_Cammaert
Partner - Champion III
Partner - Champion III

Note that when you add dimensions to your straight table, you may have to add them to the aggr() function as well.

Peter_Cammaert
Partner - Champion III
Partner - Champion III

That depends on whether or not Month is a dimension in your table.

My first suggestion =count(DISTINCT Names) would serve you well in a table with just Month as a dimension. The second one should do in any other table.

Not applicable
Author

Hi,

below is sample answer i got:

MonthSalesRepIDDistinct RepsDistinct SalesDateTotal VisitsDistinct Unique Visits
Apr003211121
Apr00431180
Apr0082113-
Apr0065113-

On Distinct Unique Visits it should be only 1 for all Rows.

I can't get this right, its giving me a headache.

=aggr(Count(DISTINCT SalesDate),SalesDate)

petter
Partner - Champion III
Partner - Champion III

AutoNumber is a function that is available only in a load script. So you could pre-calculate it in a Load Script.

If you want it dynamically assigned you will have to do  Count(DISTINCT Id) in a chart:

Dimensions:   Id, Months, Names

Expressions: Sum(Visits), Count(DISTINCT Id)

For the Count(DISTINCT Id) in a Straight Table you will have to on the Expressions Tab select Sum of Rows for Total Mode for that particular expression.

In a Pivot Table you will have to have a slightly different expression for the last expression:

If( RowNo() = 0 , Count(NoOfRows()) - 1 , Count(DISTINCT Id) )

petter
Partner - Champion III
Partner - Champion III

2015-05-06 #1.PNG