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

Announcements
Qlik Open Lakehouse is Now Generally Available! Discover the key highlights and partner resources here.
cancel
Showing results for 
Search instead for 
Did you mean: 
narender123
Specialist
Specialist

How to use distinct function .

Hi All,

My current expression is :

=Count({<flag={1}>}distinct filer)

This distinct will work for monthly basis as my dimension is month wise.But I want this distinct function based on Yearly basis with the same monthly dimension.How i cant achieve this.

table:

Column      No of Filer

-----------------------------------------

Jan2014               3

Feb2014              4

Mar2014              5

Apr2014               6

-

-

Dec2014            15

Thanks,

Narender

14 Replies
narender123
Specialist
Specialist
Author

Hi Tresco,

Thanks for the reply.

This time i dont have qlikview.As i am working on server directly.But i have shown the condition in my original query.

table:

Column      No of Filer

-----------------------------------------

Jan2014               3

Feb2014              4

Mar2014              5

Apr2014               6

-

-

Dec2014            15

I am using this:

=Count({<flag={1}>}distinct filer)


Pls advice?

tresesco
MVP
MVP

Sorry, expected output isn't yet crear to me.

Not applicable

Hi ,

Please create some sample dummy record set with expected output in excel. It will help us to understand actual requirement .

thanks

jonathandienst
Partner - Champion III
Partner - Champion III

Hi

I assume what you want to is count each Filer once. After it has been counted in one month, you no longer want to count it in later months. In other words, you want a count of the first time the Filer exists.

This is going to be tricky in an expression and if your data set is large, it may perform badly. So what I recommend is that a flag is created during load - the first time each Filer is encountered, the flag is set to 1. In later months, the flag is set to 0. Something like this (assuming you load the data in date order):

LOAD ....

     date,

     filer

     If(Exists(filerID), 0, 1) As FirstInstanceFlag,

     ....

And then in your table, the expression becomes simply:

  =Sum({<flag={1}>} FirstInstanceFlag)


HTH

Jonathan

Logic will get you from a to b. Imagination will take you everywhere. - A Einstein
Peter_Cammaert
Partner - Champion III
Partner - Champion III

Open the original discussion. Do not view my reply in your Inbox or on your phone. The attachment will only be visible/downloadable in the original discussion.