Skip to main content
Announcements
Qlik Connect 2024! Seize endless possibilities! LEARN MORE
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

count bars on a bar chart

I want to know how many charts there are in a barchart:

jaar.png

This chart should give the amount of 12 because there are 12 months shown.

weeknummers.png

Here it should give 5 because there are 5 weeknumbers shown.


Why do i want to know this? the red line ("gemiddelde"= average) doesn't work properly. in the top chart it does work because i count all the consults and divide them through 12. in the second chart he should count all de consults but divide them through 5. Problem is that he still divides through 12.

1 Solution

Accepted Solutions
MK_QSL
MVP
MVP

COUNT(DISTINCT Month)

View solution in original post

5 Replies
MK_QSL
MVP
MVP

COUNT(DISTINCT Month)

Not applicable
Author

Thanks!! so easy... didn't think about that :$

Not applicable
Author

the problem i have right now is that it aren't all months. It's a drilldown group with months, weeks, days, etc in it. Is there a way where i can =count(DISTINCT GetCurrentField(Tijd))

Because this doesn't work

Not applicable
Author

You can use the =GetCurrentField(MyDateGroup) to obtain the current level in the group and use an expression like this:

Variable: v_current_date "=GetCurrentField(MyDateGroep)"

And use an expression with an IF statement to get the right calculation depending on the selected level:

if(v_current_date='Month',

  COUNT(DISTINCT Month),

  if(v_current_date='Week',

  COUNT(DISTINCT Week),

  COUNT(DISTINCT Day)

  ))

MK_QSL
MVP
MVP

=COUNT(DISTINCT $(=GetCurrentField([Group Name])))