Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hi!
I'm in this situation:
Type | Count element
A | 10
B | 15
C | 20
D | 5
From this table i need to obtain another table (and relative pie chart) where Type C elements are included 50% into A and the other 50% into B. So something like that:
A+50%C | 20
B+50%C | 25
D | 5
How i can reach this result?
Thanks!
@simoj89 try below
=if(match(Type,'A','B'),Count({<Type-={"C"}>}Code)+ (Count(total {<Type={"C"}>}Code)*0.5),
Count({<Type-={"C"}>}Code))
@simoj89 like ?
in dimension :
=if(Type<>'C',Type)
and Supress when value is null
in expression:
sum([Count element])+sum({<Type={'C'}>} total [Count element])*0.5
output:
@simoj89 what is the expression used for count of element?
Maybe i've made a bit of confusion with the "Count Element", it isn't a dimension, is a real count measure.
The starting table is like:
Code | Type | ecc ecc
001 | A | ecc ecc
002 | A | ecc ecc
003 | A | ecc ecc
004 | A | ecc ecc
005 | B | ecc ecc
006 | B | ecc ecc
007 | B | ecc ecc
008 | C | ecc ecc
009 | C | ecc ecc
010 | D | ecc ecc
011 | D | ecc ecc
012 | D | ecc ecc
In qlik i've one KPI that shows all the 4 Types with a conut(code) measure.
In anothere KPI i need to show only Types A,B and D and the count(code) of Type C must be considered half in Type A and half in Type B.
So the output i expect is
Type | Count(code)
A | 5 (equals: 4 from Count(Type A, code) + 1 from Count(Type C,code)/2)
B | 4 (equals: 3 from Count(Type B, code) + 1 from Count(Type C,code)/2)
D | 3 (equals: 3 from Count(Type D, code))
Hope is better explained now!
@simoj89 try below
=if(match(Type,'A','B'),Count({<Type-={"C"}>}Code)+ (Count(total {<Type={"C"}>}Code)*0.5),
Count({<Type-={"C"}>}Code))
@simoj89 just a follow up question. If count is odd number like "3" then how would you count that as 50% of it will be 1.5 , so would you like to do rounding after addition?
Yes, i've put the round() function in the measure expression and works perfect!