Skip to main content
Announcements
See what Drew Clarke has to say about the Qlik Talend Cloud launch! READ THE BLOG
cancel
Showing results for 
Search instead for 
Did you mean: 
fbi
Contributor III
Contributor III

Count function give a wrong value

Hello everybody!

I used the count function to calculate the total number of order lines Count(Orderlines).

Please see column "Antal Inköpsorderrader" and it's grouped per YearMonth (Period)

This total (12) is wrong and you can see it in the next table which instead shows only 8 orderlines.

thanks a lot in advance for any kind of help

fbi_0-1660825884750.png

fbi_1-1660826072419.png

 

 

Labels (1)
2 Replies
Or
MVP
MVP

As per my response in your previous posts, this is likely a duplication in your data structure. You'll need to check the different joins (or underlying queries) and find out what's causing it, and then get it fixed. Otherwise, every formula you write is going to need some sort of aggr() to work around the problem of an incorrect data structure. 

Note that your table does not show there are only 8 lines, it shows there are eight *distinct* lines for that combination of dimensions only. Consider:

Load * INLINE [
Dim1, Dim2, Dim3, Dim4
Hello, World, Foo, Bar
Hello, World, Foo, Bar
Hello, World, Foo
This, Is, New, Line
];

With all four dimensions in a table, it will only contain three lines:

Or_0-1660827805968.png

And with only the first three dimensions, the table will contain two lines:

Or_1-1660827832802.png

Though of course in both cases, there are actually four lines in the data.

 

 

marcus_sommer

If there is no unique ID field within your data you may create one with recno() and rowno() within the relevant load(s) and then adding these fields to your table-box - now you will see which records are really within your table and from which origin record they come from.

- Marcus