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

Enhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.

Reply
ddhingra
New Member

Conditional Formatting With Average of Previous 3 Months

I have month wise Depatrment wise Consumption. Now i  want to take Average of Previos 3 month consumption.

 

In case consumption of current month is more than average of previous 3 months, then i want red sign next to the current month value in my table and in case it is less than the average of previous 3 months, then i want green sign next to the current month value.

 

Sample table below

 

ddhingra_0-1686558279008.png

 

1 REPLY 1
tamerj1
Super User
Super User

Hi @ddhingra 
You can try the following format measure, 1 is green and 0 is red

Formatting Measure =
VAR CurrentConsumption = [Consumption]
VAR Average3MonthsConsumption =
    AVERAGEX (
        TOPN (
            3,
            SUMMARIZE (
                ALLSELECTED ( 'Table' ),
                'Date'[YearMonth],
                "@Consumption", CALCULATE ( [Consumption], ALL ( 'Date'[MonthName] ) )
            ),
            'Date'[YearMonth], ASC
        ),
        [@Consumption]
    )
RETURN
    INT ( Average3MonthsConsumption > CurrentConsumption )

Helpful resources

Announcements
July 2025 community update carousel

Fabric Community Update - July 2025

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

July PBI25 Carousel

Power BI Monthly Update - July 2025

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

Join our Fabric User Panel

Join our Fabric User Panel

This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.