Forum Discussion
Conditional formatting of Matrix based on Total average
- 6 years ago
Hi GarethW ,
First of all let me apologize for the late response I must have missed this post on the multiple notifications I have.
What I think I was abble to get it to work I have created 3 measures (this simplifies the tough process):
% per category/month = DIVIDE ( COUNT ( 'Table'[Region] ); CALCULATE ( COUNT ( 'Table'[Region] ); ALLSELECTED ( 'Table'[Region] ) ) ) % Total/region = VAR temp_table = FILTER ( SUMMARIZE ( ALLSELECTED ( 'Table' ); 'Table'[Region]; "@count"; COUNT ( 'Table'[Region] ) ); 'Table'[Region] = MAX ( 'Table'[Region] ) ) VAR total_table = SUMMARIZE ( ALLSELECTED ( 'Table' ); 'Table'[Region]; "@count"; COUNT ( 'Table'[Region] ) ) RETURN DIVIDE ( SUMX ( temp_table; [@count] ); SUMX ( total_table; [@count] ) ) % variation = [% per category/month]-[% Total/region]Now use the last measure to create your condittional formatting.
As you can see on the image below the values that are equal to the region total are blank below are red and above are green.
Check also the PBIX file attached.
Once more I'm very sorry for the delay in the answer.
Hi GarethW ,
First of all let me apologize for the late response I must have missed this post on the multiple notifications I have.
What I think I was abble to get it to work I have created 3 measures (this simplifies the tough process):
% per category/month =
DIVIDE (
COUNT ( 'Table'[Region] );
CALCULATE ( COUNT ( 'Table'[Region] ); ALLSELECTED ( 'Table'[Region] ) )
)
% Total/region =
VAR temp_table =
FILTER (
SUMMARIZE (
ALLSELECTED ( 'Table' );
'Table'[Region];
"@count"; COUNT ( 'Table'[Region] )
);
'Table'[Region] = MAX ( 'Table'[Region] )
)
VAR total_table =
SUMMARIZE (
ALLSELECTED ( 'Table' );
'Table'[Region];
"@count"; COUNT ( 'Table'[Region] )
)
RETURN
DIVIDE ( SUMX ( temp_table; [@count] ); SUMX ( total_table; [@count] ) )
% variation = [% per category/month]-[% Total/region]
Now use the last measure to create your condittional formatting.
As you can see on the image below the values that are equal to the region total are blank below are red and above are green.
Check also the PBIX file attached.
Once more I'm very sorry for the delay in the answer.
Thank you so much MFelix , Got it I'll try it by tomorrow cuz I'm now back home and if it works I'll give you my thumb👍