Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

QlikSense

I have a distinct count of records. When i include a second dimension(status), the distinct count includes the same record for 2 different status as 2 records(i would only like to consider it once, with the latest updated status).

Please can anyone help with the calculation.

Thanks

1 Solution

Accepted Solutions
Anonymous
Not applicable
Author

Hi,

Thanks a ton for your help.

There seems to be some error when i tried this approach you suggested.

I tried for some more and this below formula worked for me

Count(If(Aggr(NODISTINCT Max(Date), [Order No]) = Date, [Order No]))  as the measure formula

View solution in original post

14 Replies
devarasu07
Master II
Master II

  • Hi,


Try like this,

=Aggr(count(DISTINCT OrderID),status)


3.JPG


Thanks,

Deva

jayaseelan
Creator III
Creator III

Hi Ananya kushary,

        Can you please post the example qvf, we will bring the output.

Thanks,

Anonymous
Not applicable
Author

Here is the data:

Order No      Status                   Date

1                  Complete             03/23/2017

1                  Pending               03/22/2017

2                  In Progress          03/25/2017

2                  Pending               03/21/2017

3                  Rejected              03/22/2017

3                  In Progress          03/21/2017

My bar graph with Order No should give me distinct count =3

Also i want the graph to have a second dimension (Status of the max date). So graph should show:

1- Complete, 1-in Progress, 1-Rejected

Currently : it shows me distinct count 3, but when i include status it shows me 6 (which is incorrect).

Hope this explains

OmarBenSalem

Can you attach an image of what you curretly have (your bar chart) and you want to do with it?

OmarBenSalem

If I fully understand you, this is your source:

load* , date(Date#(Date,'MM/DD/YYYY')) as DateStatus;

load * Inline [

Order No,      Status, Date

1,                  Complete,            03/23/2017

1,                Pending ,              03/22/2017

2,                  In Progress ,        03/25/2017

2,                  Pending,03/21/2017

3,                  Rejected ,            03/22/2017

3,                In Progress ,        03/21/2017

];

And this is the desired output?

The Status bu Order No for the max Date?

Capture.PNG

See the attached App:

Anonymous
Not applicable
Author

Yeah that's quite correct.

i have attached two screenshots of my bar chart

1)the first one has one dim (BU) and distinct count of order no (4)

2)the same chart when i add a second dimension (status) shows a distinct count of 6

I would want only 4 to be displayed with the status of those 4 records (status of max date of "Update date")

Dont know if this makes sense.

OmarBenSalem

Hi Ananya,

What's this value LENEL and the dimension BU?

Can you alter your source table :

Order No      Status                   Date

1                  Complete             03/23/2017

1                  Pending               03/22/2017

2                  In Progress          03/25/2017

2                  Pending               03/21/2017

3                  Rejected              03/22/2017

3                  In Progress          03/21/2017

And add the BU dimension?

So I can figure out what you're willing to do?

And please don't forget to mark as helpful the answers that have been helpful to you (under action, button left of each message) and as correct the correct answer.

Omar,

Anonymous
Not applicable
Author

yeah i just had one scenario , so consider all these records of BU: Lenel

OmarBenSalem

Like this?

BU,   Order No      Status                   Date

Lenel,   1                  Complete             03/23/2017

Lenel,   1                  Pending               03/22/2017

Lenel,   2                  In Progress          03/25/2017

Lenel,    2                   Pending               03/21/2017

Lenel,   3                  Rejected              03/22/2017

Lenel,   3                  In Progress          03/21/2017