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

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

Reply
MKPartner
Helper I
Helper I

Conditional formating - comparing day to day

Hello, 

 

I have data downloaded daily which are filtered by days in table '12week_plan'[Data]. I have a table with columns where I'd like to implement conditional formating of each row to indicate changes of value like decreased, increaased or it's equal against previous day. 

 

bi ex.png

 

I'm using below DAX to get it: 

 

CF_Act_WK = 

    VAR ACT_DAY = CALCULATE('12week_plan'[Act_WK],
                                FILTER('12week_plan','12week_plan'[Data]))
    VAR PREV_DAY = CALCULATE('12week_plan'[Act_WK],
                                FILTER('12week_plan','12week_plan'[Data]-1))

RETURN
SWITCH(True(),
                    ACT_DAY - PREV_DAY < 0,"ColoredArrowDown",
                    ACT_DAY - PREV_DAY = 0,"ColoredArrowRight",
                                        "ColoredArrowUP")

 

My issue is that when I changing dates filter, I can always see "ColoredArrowRight" mark evan values are decreasing or increasing. 

 

Thanks for support. 

1 ACCEPTED SOLUTION
mh2587
Super User
Super User

_test = // Try this might help you
VAR CurrentDate = SELECTEDVALUE('12week_plan'[Data])
VAR PrevDate =
    CALCULATE(
        MAX('12week_plan'[Data]),
        FILTER(
            ALL('12week_plan'),
            '12week_plan'[Data] < CurrentDate
        )
    )
VAR CurrentValue = CALCULATE(SUM('12week_plan'[Act_WK]))
VAR PrevValue = CALCULATE(SUM('12week_plan'[Act_WK]), '12week_plan'[Data] = PrevDate)
RETURN
SWITCH(
    TRUE(),
    CurrentValue > PrevValue, "ColoredArrowUp",
    CurrentValue < PrevValue, "ColoredArrowDown",
    "ColoredArrowRight"
)

Did I answer your question? If so, please mark my post as a solution!


Proud to be a Super User!




LinkedIn Icon
Muhammad Hasnain



View solution in original post

1 REPLY 1
mh2587
Super User
Super User

_test = // Try this might help you
VAR CurrentDate = SELECTEDVALUE('12week_plan'[Data])
VAR PrevDate =
    CALCULATE(
        MAX('12week_plan'[Data]),
        FILTER(
            ALL('12week_plan'),
            '12week_plan'[Data] < CurrentDate
        )
    )
VAR CurrentValue = CALCULATE(SUM('12week_plan'[Act_WK]))
VAR PrevValue = CALCULATE(SUM('12week_plan'[Act_WK]), '12week_plan'[Data] = PrevDate)
RETURN
SWITCH(
    TRUE(),
    CurrentValue > PrevValue, "ColoredArrowUp",
    CurrentValue < PrevValue, "ColoredArrowDown",
    "ColoredArrowRight"
)

Did I answer your question? If so, please mark my post as a solution!


Proud to be a Super User!




LinkedIn Icon
Muhammad Hasnain



Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!

December 2025 Power BI Update Carousel

Power BI Monthly Update - December 2025

Check out the December 2025 Power BI Holiday Recap!

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.