Forum Discussion
Conditional Formatting in visualization based on the multiple columns and criteria
- 5 years ago
Hi Saxon10 ,
Looking at the data you have and taking into account that you need several formattings to different columns I did the following:
- Added an ID column to each of the tables:
ID = Report[FRUIT LIST] & Report[AREA CODE]&Report[SALES CODE] ID = Data[FRUIT LIST]&Data[AREA CODE]&Data[SALES CODE]- Hide the column in the report view
- Created the following 4 measures:
FORMATTING FRUITLIST = IF ( LOOKUPVALUE ( Data[FRUIT LIST]; Data[FRUIT LIST]; SELECTEDVALUE ( Report[FRUIT LIST] ) ) = BLANK(); "Orange"; "Green" ) FORMATTING AREACODE = IF ( LOOKUPVALUE ( Data[ID]; Data[ID]; MAX ( Report[ID] ) ) = BLANK (); IF ( LOOKUPVALUE ( Data[AREA CODE]; Data[AREA CODE]; SELECTEDVALUE ( Report[AREA CODE] ); Data[FRUIT LIST]; SELECTEDVALUE ( Report[FRUIT LIST] ) ) = BLANK(); "Orange" ) ) FORMATTING LANGUAGE = IF(SELECTEDVALUE(Report[LANGUAGE]) = BLANK(); "Orange") FORMATTING SALESCODE = IF ( LOOKUPVALUE ( Data[ID]; Data[ID]; MAX ( Report[ID] ) ) = BLANK (); IF ( LOOKUPVALUE ( Data[SALES CODE]; Data[SALES CODE]; SELECTEDVALUE ( Report[SALES CODE] ); Data[FRUIT LIST]; SELECTEDVALUE ( Report[FRUIT LIST] ) ) = BLANK(); "Orange" ) )Now I use this measure to condittional format each of the columns in the visualization:
You can change the colours by a format string similar to "#000000" and use the HEX codes.
PBIX file attach (PBI December version).
Hi Saxon10 ,
Looking at the data you have and taking into account that you need several formattings to different columns I did the following:
- Added an ID column to each of the tables:
ID = Report[FRUIT LIST] & Report[AREA CODE]&Report[SALES CODE]
ID = Data[FRUIT LIST]&Data[AREA CODE]&Data[SALES CODE]
- Hide the column in the report view
- Created the following 4 measures:
FORMATTING FRUITLIST =
IF (
LOOKUPVALUE (
Data[FRUIT LIST];
Data[FRUIT LIST]; SELECTEDVALUE ( Report[FRUIT LIST] )
) = BLANK();
"Orange";
"Green"
)
FORMATTING AREACODE =
IF (
LOOKUPVALUE ( Data[ID]; Data[ID]; MAX ( Report[ID] ) ) = BLANK ();
IF (
LOOKUPVALUE (
Data[AREA CODE];
Data[AREA CODE]; SELECTEDVALUE ( Report[AREA CODE] );
Data[FRUIT LIST]; SELECTEDVALUE ( Report[FRUIT LIST] )
) = BLANK();
"Orange"
)
)
FORMATTING LANGUAGE = IF(SELECTEDVALUE(Report[LANGUAGE]) = BLANK(); "Orange")
FORMATTING SALESCODE =
IF (
LOOKUPVALUE ( Data[ID]; Data[ID]; MAX ( Report[ID] ) ) = BLANK ();
IF (
LOOKUPVALUE (
Data[SALES CODE];
Data[SALES CODE]; SELECTEDVALUE ( Report[SALES CODE] );
Data[FRUIT LIST]; SELECTEDVALUE ( Report[FRUIT LIST] )
) = BLANK();
"Orange"
)
)
Now I use this measure to condittional format each of the columns in the visualization:
You can change the colours by a format string similar to "#000000" and use the HEX codes.
PBIX file attach (PBI December version).
thank you so much for your quick action. I will check and come back you.