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 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.
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?
- v-zhenbw-msft6 years agoCommunity Support
Hi kodnil2020 ,
Please check what type of field Table 2[active] is. Please change the active column to Whole number type and try again.
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.