Forum Discussion
Colors in matrix columns
- Anonymous4 years ago
Hi hylosko ,
I created some data:
Here are the steps you can follow:
1. Use Enter data to create a table..
2. Create measure.
T1_CAT1_Measure = SUMX( FILTER(ALL('Table'), 'Table'[Type]="Type1"&&'Table'[Group]="CAT1"),[Amount])T1_CAT2_Measure = SUMX( FILTER(ALL('Table'), 'Table'[Type]="Type1"&&'Table'[Group]="CAT2"),[Amount])T1_CAT3_Measure = SUMX( FILTER(ALL('Table'), 'Table'[Type]="Type1"&&'Table'[Group]="CAT3"),[Amount])T1_CAT4_Measure = SUMX( FILTER(ALL('Table'), 'Table'[Type]="Type1"&&'Table'[Group]="CAT4"),[Amount])T1_CAT5_Measure = SUMX( FILTER(ALL('Table'), 'Table'[Type]="Type1"&&'Table'[Group]="CAT5"),[Amount])T1_CAT6_Measure = SUMX( FILTER(ALL('Table'), 'Table'[Type]="Type1"&&'Table'[Group]="CAT6"),[Amount])T2_CAT1_Measure = SUMX( FILTER(ALL('Table'), 'Table'[Type]="Type2"&&'Table'[Group]="CAT1"),[Amount])T2_CAT2_Measure = SUMX( FILTER(ALL('Table'), 'Table'[Type]="Type2"&&'Table'[Group]="CAT2"),[Amount])T2_CAT3_Measure = SUMX( FILTER(ALL('Table'), 'Table'[Type]="Type2"&&'Table'[Group]="CAT3"),[Amount])T2_CAT3_Measure = SUMX( FILTER(ALL('Table'), 'Table'[Type]="Type2"&&'Table'[Group]="CAT3"),[Amount])T2_CAT4_Measure = SUMX( FILTER(ALL('Table'), 'Table'[Type]="Type2"&&'Table'[Group]="CAT4"),[Amount])T2_CAT5_Measure = SUMX( FILTER(ALL('Table'), 'Table'[Type]="Type2"&&'Table'[Group]="CAT5"),[Amount])T2_CAT6_Measure = SUMX( FILTER(ALL('Table'), 'Table'[Type]="Type2"&&'Table'[Group]="CAT6"),[Amount])CAT1 M = SWITCH( TRUE(), MAX('Table2'[Type])="Type1",CALCULATE([T1_CAT1_Measure], FILTER('Table','Table'[Group2]=MAX('Table2'[Group2]))), MAX('Table2'[Type])="Type2",CALCULATE([T2_CAT1_Measure], FILTER('Table','Table'[Group2]=MAX('Table2'[Group2]))))CAT2 M = SWITCH( TRUE(), MAX('Table2'[Type])="Type1",CALCULATE([T1_CAT2_Measure], FILTER('Table','Table'[Group2]=MAX('Table2'[Group2]))), MAX('Table2'[Type])="Type2",CALCULATE([T2_CAT2_Measure], FILTER('Table','Table'[Group2]=MAX('Table2'[Group2]))))CAT3 M = SWITCH( TRUE(), MAX('Table2'[Type])="Type1",CALCULATE([T1_CAT3_Measure], FILTER('Table','Table'[Group2]=MAX('Table2'[Group2]))), MAX('Table2'[Type])="Type2",CALCULATE([T2_CAT3_Measure], FILTER('Table','Table'[Group2]=MAX('Table2'[Group2]))))CAT4 M = SWITCH( TRUE(), MAX('Table2'[Type])="Type1",CALCULATE([T1_CAT4_Measure], FILTER('Table','Table'[Group2]=MAX('Table2'[Group2]))), MAX('Table2'[Type])="Type2",CALCULATE([T2_CAT4_Measure], FILTER('Table','Table'[Group2]=MAX('Table2'[Group2]))))CAT5 M = SWITCH( TRUE(), MAX('Table2'[Type])="Type1",CALCULATE([T1_CAT5_Measure], FILTER('Table','Table'[Group2]=MAX('Table2'[Group2]))), MAX('Table2'[Type])="Type2",CALCULATE([T2_CAT5_Measure], FILTER('Table','Table'[Group2]=MAX('Table2'[Group2]))))CAT6 M = SWITCH( TRUE(), MAX('Table2'[Type])="Type1",CALCULATE([T1_CAT6_Measure], FILTER('Table','Table'[Group2]=MAX('Table2'[Group2]))), MAX('Table2'[Type])="Type2",CALCULATE([T2_CAT6_Measure], FILTER('Table','Table'[Group2]=MAX('Table2'[Group2]))))3. Create calculated column.
Color = IF( 'Table2'[Type]="Type1","yellow", "blue")4. Open the matrix and place the calculated columns and measures as follows.
5. Open the format of the matrix – Cell elements – Series select each measure – open the Background dolor – fx.
Here [CAT1 M] is the column - click fx of Background color
Enter the Background color interface
Format style – Field value
What field should we base this on - select [Color] of Table2
[CAT1 M], [CAT2 M], [CAT3 M], [CAT4 M], [CAT5 M], [CAT6 M] do this
6. Result:
If you need pbix, please click here.
Best Regards,
Liu Yang
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly
Hi hylosko ,
I created some data:
Here are the steps you can follow:
1. Use Enter data to create a table..
2. Create measure.
T1_CAT1_Measure =
SUMX(
FILTER(ALL('Table'),
'Table'[Type]="Type1"&&'Table'[Group]="CAT1"),[Amount])T1_CAT2_Measure =
SUMX(
FILTER(ALL('Table'),
'Table'[Type]="Type1"&&'Table'[Group]="CAT2"),[Amount])T1_CAT3_Measure =
SUMX(
FILTER(ALL('Table'),
'Table'[Type]="Type1"&&'Table'[Group]="CAT3"),[Amount])T1_CAT4_Measure =
SUMX(
FILTER(ALL('Table'),
'Table'[Type]="Type1"&&'Table'[Group]="CAT4"),[Amount])T1_CAT5_Measure =
SUMX(
FILTER(ALL('Table'),
'Table'[Type]="Type1"&&'Table'[Group]="CAT5"),[Amount])T1_CAT6_Measure =
SUMX(
FILTER(ALL('Table'),
'Table'[Type]="Type1"&&'Table'[Group]="CAT6"),[Amount])T2_CAT1_Measure =
SUMX(
FILTER(ALL('Table'),
'Table'[Type]="Type2"&&'Table'[Group]="CAT1"),[Amount])T2_CAT2_Measure =
SUMX(
FILTER(ALL('Table'),
'Table'[Type]="Type2"&&'Table'[Group]="CAT2"),[Amount])T2_CAT3_Measure =
SUMX(
FILTER(ALL('Table'),
'Table'[Type]="Type2"&&'Table'[Group]="CAT3"),[Amount])T2_CAT3_Measure =
SUMX(
FILTER(ALL('Table'),
'Table'[Type]="Type2"&&'Table'[Group]="CAT3"),[Amount])T2_CAT4_Measure =
SUMX(
FILTER(ALL('Table'),
'Table'[Type]="Type2"&&'Table'[Group]="CAT4"),[Amount])T2_CAT5_Measure =
SUMX(
FILTER(ALL('Table'),
'Table'[Type]="Type2"&&'Table'[Group]="CAT5"),[Amount])T2_CAT6_Measure =
SUMX(
FILTER(ALL('Table'),
'Table'[Type]="Type2"&&'Table'[Group]="CAT6"),[Amount])
CAT1 M =
SWITCH(
TRUE(),
MAX('Table2'[Type])="Type1",CALCULATE([T1_CAT1_Measure],
FILTER('Table','Table'[Group2]=MAX('Table2'[Group2]))),
MAX('Table2'[Type])="Type2",CALCULATE([T2_CAT1_Measure],
FILTER('Table','Table'[Group2]=MAX('Table2'[Group2]))))CAT2 M =
SWITCH(
TRUE(),
MAX('Table2'[Type])="Type1",CALCULATE([T1_CAT2_Measure],
FILTER('Table','Table'[Group2]=MAX('Table2'[Group2]))),
MAX('Table2'[Type])="Type2",CALCULATE([T2_CAT2_Measure],
FILTER('Table','Table'[Group2]=MAX('Table2'[Group2]))))
CAT3 M =
SWITCH(
TRUE(),
MAX('Table2'[Type])="Type1",CALCULATE([T1_CAT3_Measure],
FILTER('Table','Table'[Group2]=MAX('Table2'[Group2]))),
MAX('Table2'[Type])="Type2",CALCULATE([T2_CAT3_Measure],
FILTER('Table','Table'[Group2]=MAX('Table2'[Group2]))))
CAT4 M =
SWITCH(
TRUE(),
MAX('Table2'[Type])="Type1",CALCULATE([T1_CAT4_Measure],
FILTER('Table','Table'[Group2]=MAX('Table2'[Group2]))),
MAX('Table2'[Type])="Type2",CALCULATE([T2_CAT4_Measure],
FILTER('Table','Table'[Group2]=MAX('Table2'[Group2]))))CAT5 M =
SWITCH(
TRUE(),
MAX('Table2'[Type])="Type1",CALCULATE([T1_CAT5_Measure],
FILTER('Table','Table'[Group2]=MAX('Table2'[Group2]))),
MAX('Table2'[Type])="Type2",CALCULATE([T2_CAT5_Measure],
FILTER('Table','Table'[Group2]=MAX('Table2'[Group2]))))CAT6 M =
SWITCH(
TRUE(),
MAX('Table2'[Type])="Type1",CALCULATE([T1_CAT6_Measure],
FILTER('Table','Table'[Group2]=MAX('Table2'[Group2]))),
MAX('Table2'[Type])="Type2",CALCULATE([T2_CAT6_Measure],
FILTER('Table','Table'[Group2]=MAX('Table2'[Group2]))))
3. Create calculated column.
Color =
IF(
'Table2'[Type]="Type1","yellow",
"blue")
4. Open the matrix and place the calculated columns and measures as follows.
5. Open the format of the matrix – Cell elements – Series select each measure – open the Background dolor – fx.
Here [CAT1 M] is the column - click fx of Background color
Enter the Background color interface
Format style – Field value
What field should we base this on - select [Color] of Table2
[CAT1 M], [CAT2 M], [CAT3 M], [CAT4 M], [CAT5 M], [CAT6 M] do this
6. Result:
If you need pbix, please click here.
Best Regards,
Liu Yang
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly