Skip to main content
Announcements
Have questions about Qlik Connect? Join us live on April 10th, at 11 AM ET: SIGN UP NOW
cancel
Showing results for 
Search instead for 
Did you mean: 
JustinDallas
Specialist III
Specialist III

Count of Items in Chart and Table differs

Hello Everyone,

I have a chart and a table that both have the same backing formula.  The fundamental problem is that in my Table, I have 3 rows, and in my Bar Chart, I have a count of "2".

Before I show the chart and table, my measures look like so:

Bar Chart:

COUNT(

Aggr(

  If(

  ([TractorStatusHistory.StatusStartDate] <  Min(TOTAL CalDate)) and

  ([TractorStatusHistory.StatusEndDate] > Max(TOTAL CalDate)), 

  [%tractorNumber]),

        [%tractorNumber])

)

Table:

If(

  [TractorStatusHistory.StatusStartDate] < Min(TOTAL CalDate)

  and [TractorStatusHistory.StatusEndDate] > Max(TOTAL CalDate),

  [%tractorNumber]

)

While they look the same, the output is quite different with the Table having 3 rows, and the Bar Chart counting 2

BadCount.png

Does anyone have a clue of how I can see the exact rows making up the bar chart?  Or better yet, are the two statements above semantically equivalent?  I'm not sure how to proceed.

Any help is greatly appreciated.

4 Replies
sunny_talwar

Does it make any difference if you use this

Sum(Aggr(If([TractorStatusHistory.StatusStartDate] <  Min(TOTAL CalDate) and [TractorStatusHistory.StatusEndDate] > Max(TOTAL CalDate), 1, 0), [%tractorNumber]))

JustinDallas
Specialist III
Specialist III
Author

For reasons that I am completely unaware of, the following solution gave me what I wanted.

COUNT( DISTINCT

  If(

  ([TractorStatusHistory.StatusStartDate] <  Min(TOTAL CalDate)) and

  ([TractorStatusHistory.StatusEndDate] > Max(TOTAL CalDate)), 

  [%tractorNumber]

    )

)


I'm not sure why or how this works.

sunny_talwar

Really? I would love to see a sample where this worked

dwforest
Specialist II
Specialist II

My guess is that the Aggr was affecting the value returned by the Min/Max CalDate, even though TOTAL was specified. maybe it was within the Aggr grouping?