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

Announcements
Qlik Open Lakehouse is Now Generally Available! Discover the key highlights and partner resources here.
cancel
Showing results for 
Search instead for 
Did you mean: 
elrelrelr
Contributor
Contributor

Calculated dimension in chart and total

I have a stacked bar chart where the columns are split by a calculated dimension. What I want to have is a stacked barchart with all bars showing the percentages (i.e. summing to 1)

DIMENSIONS

Dim 1 year
Dim 2 =aggr({$*BM01} count(distinct [case_id]),  [person_id], [year] )

EXPRESSIONS

No of unique persons 
=count(distinct {$*BM01} [person_id])
Total for each year
=count( total <[year]> distinct  {$*BM01}  [person_id])

 

However, the two expressions just gives me the same numbers, and I have also tried with the <person id> after the total. Any other suggestions for how to achieve what I wanted?

So far, the best solution I have tried is a Mekko-chart, however, I am still not able to find out how to get labels with dim 2's share of each column.

Moving the calculation to the script is not an option.

 

1 Solution

Accepted Solutions
sunny_talwar

Not entirely sure, but does this help

=Aggr(NODISTINCT Count(DISTINCT {$*BM01}  [person_id]), year)

View solution in original post

2 Replies
sunny_talwar

Not entirely sure, but does this help

=Aggr(NODISTINCT Count(DISTINCT {$*BM01}  [person_id]), year)
elrelrelr
Contributor
Contributor
Author

Great, that was exactly what i needed 🙂

(Now i just need to understand why that worked)