Forum Discussion
conditional formatting
- 3 years ago
Hi HAMZA_07
On the columns Date, Net Positions, Long %, Short %, TOTAL and Index you apply the custom format has a value using the metric TOP Rows Format:
On the columns for the long / short where you want to have the divergent you apply the divergent but instead of select the value of the column you select the measure Percentile variation (short or long depending).
The blank values that are marked in my case has blue you need to set to yellow
Hi HAMZA_07 ,
For this you need to do some advance editing of the condittional formating this also depends on how you want to format the rows below.
For the first 3 lines create a metric similar to this:
TOP ROWS FORMATTING = IF(SELECTEDVALUE('Table (2)'[Index]) <=3 , "#118DFF")
This need to be used on all your columns has condittional formatting.
For the Long and Short depends on how you want to do the conditional formatting if it's by the diverging colours you need to add the following two metrics for each column:
percentile long =
IF (
SELECTEDVALUE ( 'Table (2)'[Index] ) > 3,
CALCULATE (
PERCENTILE.EXC ( 'Table (2)'[Long], 0.5 ),
FILTER ( ALL ( 'Table (2)' ), 'Table (2)'[Index] > 3 )
)
)
Percentile_Long_Variation =
IF (
SELECTEDVALUE ( 'Table (2)'[Index] ) > 3,
SUM ( 'Table (2)'[Long] ) - [percentile long]
)
Now use this has the condittional formatting of the long column:
Be aware that you need to select the specific colour for empty values
If the Long/Short has specific rules the you need to change the percentile to the specific rules using a swich statment:
I have created the following rule for short:
Format Short =
SWITCH( TRUE(),
SELECTEDVALUE ( 'Table (2)'[Index] ) <= 3, "#118DFF",
SUM('Table (2)'[Short]) <= 11000, "Green",
SUM('Table (2)'[Short]) <= 14000, "Red",
SUM('Table (2)'[Short]) <= 99000, "BLue"
)
On the example above I only formated the Date , long short and net positions but you can do it for all the columns.
Thank you for your reply, but I did not understand how to apply the new metric... I want the first three rows to be like what you applied in a picture, but in yellow color... and the columns like the picture below
- MFelix3 years agoSuper User
Hi HAMZA_07
On the columns Date, Net Positions, Long %, Short %, TOTAL and Index you apply the custom format has a value using the metric TOP Rows Format:
On the columns for the long / short where you want to have the divergent you apply the divergent but instead of select the value of the column you select the measure Percentile variation (short or long depending).
The blank values that are marked in my case has blue you need to set to yellow