Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
Anonymous
Not applicable

Conditional Formatting by Quarter

Hi All,

 

I am trying to apply conditional formatting on minimum & maximum values per quarter as below.

Can anyone guide me on the same?

 

Capture.JPG

 

1 ACCEPTED SOLUTION

@Anonymous ,

 

So the percentage value in your matrix is a measure you have created and you need to color the highest and lowest measure value per quarter, right?

 

If so, you need to convert the measure to calculate column and then create a measure to set the color rule:

Color =
VAR Max_Percentage =
    CALCULATE ( MAX ( Table[Percentage] ), ALLEXCEPT ( Table, Table[quarter] ) )
VAR Min_Percentage =
    CALCULATE ( MIN ( Table[Percentage] ), ALLEXCEPT ( Table, Table[quarter] ) )
RETURN
    SWITCH ( Table[Percentage], Max_Percentage, "Red", Min_Percentage, "Blue" )

Then click condition formatting pane of the matrix visual and select Field Value based the Color measure:

Capture.PNG 

 

Community Support Team _ Jimmy Tao

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

5 REPLIES 5
Anonymous
Not applicable

Hi All,

 

Thanks for response.

 

I am using a matrix here, The numbers in output are a calculated measure.

I don't see an option of attaching pbi file here.

 

I am using a calculated measure to derive the % difference between quarter vs previous quarter.

Below are the screen shot of raw data & output table for which I need to highlight (conditional formatting) for highest & lowest value per quarter.

 

Raw_Data.JPGFinal_Output.JPG

 

Regards,

 

Dipali

                        

@Anonymous ,

 

So the percentage value in your matrix is a measure you have created and you need to color the highest and lowest measure value per quarter, right?

 

If so, you need to convert the measure to calculate column and then create a measure to set the color rule:

Color =
VAR Max_Percentage =
    CALCULATE ( MAX ( Table[Percentage] ), ALLEXCEPT ( Table, Table[quarter] ) )
VAR Min_Percentage =
    CALCULATE ( MIN ( Table[Percentage] ), ALLEXCEPT ( Table, Table[quarter] ) )
RETURN
    SWITCH ( Table[Percentage], Max_Percentage, "Red", Min_Percentage, "Blue" )

Then click condition formatting pane of the matrix visual and select Field Value based the Color measure:

Capture.PNG 

 

Community Support Team _ Jimmy Tao

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

fhill
Resident Rockstar
Resident Rockstar

If you are creating a Matrix, here's an option...

 

Create a Custom Column in your table containing your Matrix values.  (If you are performing sums or more complex calculations for each value, you may need to post sample data to help us determine the correct code...)

 

This will place (By SINGLE DATE Value - not a Range of Dates) a 1 or 0 in a Marker Column.  Note Matching Values (if you have 2 Max or Mins) will have duplicate colors)

Marker = IF(Table1[Value] = CALCULATE(MAX(Table1[Value]), FILTER( Table1, Table1[Date] = EARLIER(Table1[Date]))), 1,
IF(Table1[Value] = CALCULATE(MIN(Table1[Value]), FILTER(Table1, Table1[Date] = EARLIER(Table1[Date]))), 0, BLANK()))

 

Create your Matrix and Conditionally Format the Back ground Color based on the 'Marker' Column...

 

Background Color = Value  /  Based on 'Sum of Marker'

If value is 1 then Green  /  if Value is 0 then Red

 

This is my raw data, again if you have more complex data or calculations, we'll need to see the raw input to help further.

DateLevelValueMarker
12/1/2018 0:00A681
12/1/2018 0:00B57 
12/1/2018 0:00C380
12/1/2018 0:00D65 
12/1/2018 0:00E42 
1/1/2019 0:00A15 
1/1/2019 0:00B13 
1/1/2019 0:00C10 
1/1/2019 0:00D161
1/1/2019 0:00E90
2/1/2019 0:00A13 
2/1/2019 0:00B171
2/1/2019 0:00C90
2/1/2019 0:00D12 
2/1/2019 0:00E13 
3/1/2019 0:00A201
3/1/2019 0:00B15 
3/1/2019 0:00C80
3/1/2019 0:00D19 
3/1/2019 0:00E10 
4/1/2019 0:00A181
4/1/2019 0:00B12 
4/1/2019 0:00C11 
4/1/2019 0:00D181
4/1/2019 0:00E100



Did I answer your question, or help you along the way?
Please give Kudos or Mark as a Solution!


https://www.linkedin.com/in/forrest-hill-04480730/

Proud to give back to the community!
Thank You!




v-yuta-msft
Community Support
Community Support

@Anonymous ,

 

Could you please share the sample data(table format) and give the logic of the conditional formatting?

 

Regards,

Jimmy Tao

Anonymous
Not applicable

Hi Dipali - 

 

Can you pls share a sample file to get an idea of what you are trying to achieve?

 

I want to know if you are planning to use a matrix or a table visual, as we can use conditional formatting only in one of these at the moment.

 

Regards

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.