Forum Discussion
Create Clustered column Chart
- 6 years ago
Hi kodnil2020 ,
We can create a column and a matrix table to meet your requirement.
1. Create a calculate column to sort Grade.
Legend = SWITCH( TRUE(), CONTAINSSTRING('Table 1'[Grade],"A"),"A", CONTAINSSTRING('Table 1'[Grade],"B"),"B", CONTAINSSTRING('Table 1'[Grade],"C"),"C","D & Above")Then we can create a measure and put the column to legend in Clustered Column Chart.
Measure = var _x = CALCULATE(DISTINCTCOUNT('Table 1'[ID]),FILTER('Table 2','Table 2'[Active]=1)) var _y = CALCULATE(DISTINCTCOUNT('Table 1'[ID]),FILTER(ALLSELECTED('Table 2'),'Table 2'[Active]=1),FILTER(ALLSELECTED('Table 1'),'Table 1'[Department]=MAX('Table 1'[Department]))) return DIVIDE(_x,_y)If you have any question, please kindly ask here and we will try to resolve it.
Best regards,
Community Support Team _ zhenbw
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
BTW, pbix as attached.
Hi kodnil2020 ,
We can use the following steps to meet your requirement.
1. We assume that the two tables have a relationship based on [ID].
2. Then we can create a measure.
active person count = CALCULATE(DISTINCTCOUNT('Table 2'[ID]),FILTER('Table 2','Table 2'[Active]=1))
Or this measure is also right.
active sum = CALCULATE(SUM('Table 2'[Active]))
If it doesn’t meet your requirement, could you please show the exact expected result based on the table that you have shared?
Best regards,
Community Support Team _ zhenbw
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
BTW, pbix as attached.
- kodnil20206 years ago
Helper I
Yes. 2 tables are connected.
This is what i am looking for:
For all departments show clustered chart:
1. X axis: departments
2. Y Axis: percentage of Active Grades
Group all "A" grades and find percentage based on active employees
Group all "B" grades and find percentage based on active employees
Group all "C" grades and find percentage based on active employees
Group all "D & Above" grades and find percentage based on active employees
Sample graph & percentage calculation below:
- v-zhenbw-msft6 years ago
Community Support
Hi kodnil2020 ,
We can create a column and a matrix table to meet your requirement.
1. Create a calculate column to sort Grade.
Legend = SWITCH( TRUE(), CONTAINSSTRING('Table 1'[Grade],"A"),"A", CONTAINSSTRING('Table 1'[Grade],"B"),"B", CONTAINSSTRING('Table 1'[Grade],"C"),"C","D & Above")Then we can create a measure and put the column to legend in Clustered Column Chart.
Measure = var _x = CALCULATE(DISTINCTCOUNT('Table 1'[ID]),FILTER('Table 2','Table 2'[Active]=1)) var _y = CALCULATE(DISTINCTCOUNT('Table 1'[ID]),FILTER(ALLSELECTED('Table 2'),'Table 2'[Active]=1),FILTER(ALLSELECTED('Table 1'),'Table 1'[Department]=MAX('Table 1'[Department]))) return DIVIDE(_x,_y)If you have any question, please kindly ask here and we will try to resolve it.
Best regards,
Community Support Team _ zhenbw
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
BTW, pbix as attached.
- kodnil20206 years ago
Helper I
I am getting below error:
"DAX comparison operations do not support comparing values of type Text with values of type Integer. Consider using the VALUE or FORMAT function to convert one of the values."
In your screen shot there are 4 filters {}, dept, legend, measure. Which one is first filter?