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

Get Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Request now

Reply
ashishd
Advocate I
Advocate I

Conditional formatting for Period over Period change in a Matrix

Hello friends,

 

Sorry, I am unable to share the PBIX file for this request but I think that this is a regular requirement and experts in this forum would be able to provide their kind guidance for the same.

 

The period in the column can be changed to Month/Quarter/Year and even the values displayed can be dynamically changed with the parameters.

The task is to color code the values in the next period based on their increment/decrement. So, it is basically color code for MoM/QoQ/YoY change (or %change) for a given row.
The Quarter is a text field here because the display format required is "Q1-2024".

Please suggest how to go ahead here.

 

ashishd_0-1723050053378.png

 

Thank you!

Ashish

 

3 REPLIES 3
amitchandak
Super User
Super User

@ashishd , you can use measure based conditional formatting

 

if you are using field parameters refer

Field Parameters- Conditional Formatting
: https://amitchandak.medium.com/field-parameters-conditional-formatting-517aacc23fdf

 

You can measure like

 

selectedAxis = maxx(FILTER('Axis Slicer', 'Axis Slicer'[Axis Slicer Order] = SELECTEDVALUE('Axis Slicer'[Axis Slicer Order])), 'Axis Slicer'[Axis Slicer])

Color = Switch( True() ,
selectedAxis = "Month", Switch(True() , [MOM %] >0 , "Green", "Red") ,
selectedAxis = "Quarter Year", Switch(True() , [QOQ %] >0 , "Green", "Red") ,
Switch(True() , [YOY %] >0 , "Green", "Red")
)

 

 

Use the color measure in conditional formatting using field value option

 

 

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

Hi @amitchandak  - Thank you for the reply.

 

Sorry, I seem to have missed asking one part of it. The first question should have been how to get the PeriodoverPeriod change with the above matrix layout as the period is dynamic and not all the period are of date type (quarter in my case is text, month is date and year is numeric).
So, I don't want the %changes to be displayed but I want the %changes values for color coding the raw values in a row.
Your above solution will come after I achieve this first step. Any guidance on this?

Regards,

Ashish

Anonymous
Not applicable

Hi, @ashishd 

 

You can try the following methods. Add a column to the calendar table about quarterly sorting.

Quarter Number = YEAR([Date])*100+QUARTER([Date])

vzhangtinmsft_0-1725343994358.png

vzhangtinmsft_1-1725344133093.png

Measure = 
Var _Sum1=CALCULATE(SUM('Table'[Value]),ALLEXCEPT('Date','Date'[Quarter Number]))
Var _Sum2=CALCULATE(SUM('Table'[Value]),FILTER(ALL('Date'),[Quarter Number]=SELECTEDVALUE('Date'[Quarter Number])-1))
RETURN
DIVIDE(_Sum1-_Sum2,_Sum1)
Color measure = IF([Measure]>0,"Green","Red")

vzhangtinmsft_2-1725344189844.png

Is this the result you expected?

 

Best Regards,

Community Support Team _Charlotte

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

Helpful resources

Announcements
Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

October Power BI Update Carousel

Power BI Monthly Update - October 2025

Check out the October 2025 Power BI update to learn about new features.

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.

Top Solution Authors