Reputation: 6260
I have the following data structure in my qlik sense desktop (version june 2019):
Time Reference Relevant
01.01.2019 1 1
01.01.2019 2 0
01.02.2019 3 0
01.02.2019 4 0
And I want to built a line chart, which displays the %-of the Total occuring references per day.
So the values would be:
01.01.2019 0.5
01.02.2019 0
What do I have to write in the formel editor? The expression: Sum(total [Relevant])/Count(total [Reference])
is not working.
What is the trick to combine a sum and count with respect to the date?
Upvotes: 0
Views: 2945
Reputation: 993
To get the count of References that have Relevant=1 you can do Count({<Relevant={1}>}Reference)
so then you can do a percentage as Count({<Relevant={1}>}Reference)/Count(Reference)
.
However since the data in your scenario is very simple, you could actually just do sum(Relevant)/count(Reference)
- no need for the total as you're not including the Reference in the second table.
If you did want a table to show what % that day was relevant whilst still showing the Reference then you'd probably want something more like Count(TOTAL<Time> {<Relevant={1}>}Reference)/Count(TOTAL<Time> Reference)
or just sum(TOTAL<Time> Relevant)/count(TOTAL<Time> Reference)
in your simple scenario.
Upvotes: 2