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

it only counts the value once

I have an app that part of the data comes from excel files and part is a direct connect.

I used the expression below on a total direct connect to count all like data in the field and it worked but when I us the same expression in my new file it only counts one DeaClass C-II per NDC.

count({<DeaClass={'C-II'}>}DeaClass)

The data below is after I removed all duplicates from the excel data file.

I am converting file from excel to direct connect desktop to enterprise.

   

NDCDeaClass
00054023525C-II
00054023625C-II
00054023763C-II
00054023863C-II
00054024425C-II
00054026425C-II
00054026525C-II
00054038663C-II
00054040444C-II
00054040450C-II
15 Replies
phaneendra_kunc
Partner - Specialist III
Partner - Specialist III

3,984 C-II in BillingArchive? as far as i see for C-ll i am getting a match of 3,786 from Billing Archive.

phaneendra_kunc
Partner - Specialist III
Partner - Specialist III

Not sure how this would count the duplicates. you will be targeting unique records as soon as you add that set anlaysis.

With duplicate for C-II is 12K, and unique values are 8k.

vinieme12
Champion III
Champion III

The OP actually wanted to count NDC , and if you want to count NDC then count NDC not any other field.

the same expression in my new file it only counts one DeaClass C-II per NDC.


I can't open the qvf; but i don't think QV will calculate unique values until you add the Distinct keyword.

Vineeth Pujari
If a post helps to resolve your issue, please accept it as a Solution.
Gysbert_Wassenaar

NDC is a key field. Do NOT use count on a key field unless it's a count distinct. Use another field from the table of which you want the count. Read this blog post for the details: Count or Count distinct?


talk is cheap, supply exceeds demand
Gysbert_Wassenaar

You load the field NDC twice in the SQL Select statement. You need to either remove one of those two lines or alias the field so it gets another name. Tables need unique field names.

BillingArchive]:

Load

    Billed,

    NDC,

    NDC as billingNDC,

    Rowno () as billingRow

SQL SELECT Billed,

// remove this line     NDC,

     NDC

FROM "FwReports"."dbo"."BillingArchive"

Where billed >= '2015-11-01' and billed <= '2015-11-30';


talk is cheap, supply exceeds demand
phaneendra_kunc
Partner - Specialist III
Partner - Specialist III

Thanks Gysbert.

Vineeth hope this helps to understand on why we don't usually do count on key fields.