Qlik Community

New to Qlik Sense

Discussion board where members can get started with Qlik Sense.

sagarjagga
New Contributor III

Bar chart creation using particular fields from dimensions

Hi All,

I am facing a challenge to create a bar chart using 2 dimensions for below data set.

   

ManagerSupervisior                                                     PAT Roll No
AnindyaABC1
AnindyaABC11
AnindyaABC22
AnindyaABC33
AnindyaDEF10
AnindyaDEF10
MehtabABC33
MehtabFED44
SagarABC21
SagarFED33

I need to create bar chart only for Anindya and sagar who are under manager and for supervisiors ABC,FED and bar chart should be 'grouped bar chart' and it should show share of count of 'PAT Roll No' under supervisior and manager dimension in respective bars. for example count of PAT roll no in Anindya in ABC and FED is 4(as there is no FED for anindya) so ABC bar chart will show 100%(4/4) and for FED it will be 0%

Then for sagar count of pat roll no under ABC and FED is 2(1+1) so 50% for ABC bar(1/2) and 50% for FED bar(1/2)


Thanks,

Tags (1)
1 Solution

Accepted Solutions

Re: Bar chart creation using particular fields from dimensions

Try this

Count(DISTINCT {<Supervisior = {'ABC', 'FED'}, Manager = {'Anindya', 'Sagar'}>}[PAT Roll No])/

Sum(TOTAL <Manager> Aggr(Count(DISTINCT {<Supervisior = {'ABC', 'FED'}, Manager = {'Anindya', 'Sagar'}>}[PAT Roll No]), Manager, Supervisior))

16 Replies

Re: Bar chart creation using particular fields from dimensions

Try this

Count({<Supervisior = {'ABC', 'FED'}, Manager = {'Anindya', 'Sagar'}>}[PAT Roll No])/Count(TOTAL <Manager> {<Supervisior = {'ABC', 'FED'}, Manager = {'Anindya', 'Sagar'}>}[PAT Roll No])

sagarjagga
New Contributor III

Re: Bar chart creation using particular fields from dimensions

Hi Sunnny,

Thanks a lot. but i have one problem, PAT Roll no . can be duplicate in particular Manager and supervisior combitions. so i need to count only distinct PAT roll no under particular Manager -> Supervisior.

although a same pat roll no can come under different manager supervisior combination but that is not the concern.

I am trying to use distinct in your set analysis but getting an error.

Count(distinct {<Supervisior = {'ABC', 'FED'}, Manager = {'Anindya', 'Sagar'}>}[PAT Roll No])/Count(TOTAL distinct  <Manager> {<Supervisior = {'ABC', 'FED'}, Manager = {'Anindya', 'Sagar'}>}[PAT Roll No])

sunilkumarqv
Valued Contributor II

Re: Bar chart creation using particular fields from dimensions

Please share error

sagarjagga
New Contributor III

Re: Bar chart creation using particular fields from dimensions

No error. it is giving me wrong value

Re: Bar chart creation using particular fields from dimensions

May be try this... moved <Manager> before DISTINCT

Count(DISTINCT {<Supervisior = {'ABC', 'FED'}, Manager = {'Anindya', 'Sagar'}>}[PAT Roll No])/Count(TOTAL <Manager> DISTINCT {<Supervisior = {'ABC', 'FED'}, Manager = {'Anindya', 'Sagar'}>}[PAT Roll No])

anindya_manna
Contributor II

Re: Bar chart creation using particular fields from dimensions

Count(TOTAL <Manager> DISTINCT {<Supervisior = {'ABC', 'FED'}, Manager = {'Anindya', 'Sagar'}>}[PAT Roll No])


Above expression is finding total for distinct PAT roll No. means to say, while calculating Total of count it is at first applying distinct on PAT Roll No and returning the total.


ManagerSupervisiorPAT Roll No
AnindyaABC1
AnindyaABC11
AnindyaABC22
AnindyaABC1
AnindyaABC22
AnindyaABC33
AnindyaDEF10
AnindyaDEF10
MehtabABC33
MehtabFED44
SagarABC22
SagarFED33



it is considering 22(which is present under different Manager and supervisior as well) once

Re: Bar chart creation using particular fields from dimensions

I am not sure I follow? Is there a question for me here?

sagarjagga
New Contributor III

Re: Bar chart creation using particular fields from dimensions

Hi Sunny,

Me and anindya work in same team. Inadvertently i replied you from his ID

Re: Bar chart creation using particular fields from dimensions

That is okay, I figured that part out... but what I am not sure about is the output you are expecting to get? Based on the sample provided... what is the numerical output you are looking to get?

Community Browser