Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Join us in NYC Sept 4th for Qlik's AI Reality Tour! Register Now
cancel
Showing results for 
Search instead for 
Did you mean: 
Jsobrinho77
Creator
Creator

Percentage more than 100% bar chart, total formula wrong

Hi guys,

I have the formula to calculate the percentage by category, the problem is that to show the %, the total values it's different for each category.

My chart use how dimension: 
Master Item Dimension1: Month, Day

The measure is below, as for example category A

count(distinct
{<
Year= {$(vCY)},
Month = {$(vYTD)},
Category={"A"}
>} ID_Reclamacao)
/
count(distinct
{<
Year= {$(vCY)},
Month = {$(vYTD)},
Category={"*"}
>} ID_Reclamacao)

I have 8 categories, the values for each one are to January month:

A 26 335B 22 237C 16 731D 39 087E 11 761F 5 136G 1 936H 9283


The sum of all categories is: 132.506

The return values for Category={"*"} is 131.696 ( because I'm using count distinct )

How can do I do for the denominator to return the correct value 132.506? Its necessary aggr?

Labels (2)
1 Reply
chrismarlow
Specialist II
Specialist II

Hi,

I think something like this (not tested);

count(distinct
{<
Year= {$(vCY)},
Month = {$(vYTD)},
Category={"A"}
>} ID_Reclamacao)
/
sum(aggr(count(distinct
{<
Year= {$(vCY)},
Month = {$(vYTD)},
Category={"*"}
>} ID_Reclamacao),Category)

Cheers,

Chris.