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

Vote for your favorite vizzies from the Power BI Dataviz World Championship submissions. Vote now!

Reply
ermak
Frequent Visitor

Conditional formatting in tables

Hello!

Can I configure conditional formatting so that the criterion is the previous value of the parameter? For example, in the report on positions in the search engine, I need to show whether the position has improved, deteriorated or remained unchanged.

On the screen I showed how it should look about.image.png

Thanks!

2 ACCEPTED SOLUTIONS
Mariusz
Community Champion
Community Champion

Hi @ermak 

 

You can create a measure like below and use it for conditional formating in your matrix

_arrows = 
VAR _previous = CALCULATE( SUM( 'Table'[Value] ), PREVIOUSDAY( 'Table'[Date] ) )
VAR _current = SUM( 'Table'[Value] )
RETURN SWITCH( 
    TRUE(),
    _previous = BLANK(), BLANK(),
    _previous < _current, 1,
    _previous = _current, 2,
    _previous > _current, 3
)

I've attached a file with the solution as well.

 

Best Regards,
Mariusz

If this post helps, then please consider Accepting it as the solution.

Please feel free to connect with me.
Mariusz Repczynski

 

 

View solution in original post

Mariusz
Community Champion
Community Champion

Hi @ermak

 

I've updated the formula on the attached.

 

Best Regards,
Mariusz

If this post helps, then please consider Accepting it as the solution.

Please feel free to connect with me.
LinkedIn

 

View solution in original post

4 REPLIES 4
AC_DATA
Frequent Visitor

The first thing that comes to my mind is to write a calculated column to indicate the previous status and then use that column to drive the conditional formatting using a logical less-than, greater-than, or equal-to.

Mariusz
Community Champion
Community Champion

Hi @ermak 

 

You can create a measure like below and use it for conditional formating in your matrix

_arrows = 
VAR _previous = CALCULATE( SUM( 'Table'[Value] ), PREVIOUSDAY( 'Table'[Date] ) )
VAR _current = SUM( 'Table'[Value] )
RETURN SWITCH( 
    TRUE(),
    _previous = BLANK(), BLANK(),
    _previous < _current, 1,
    _previous = _current, 2,
    _previous > _current, 3
)

I've attached a file with the solution as well.

 

Best Regards,
Mariusz

If this post helps, then please consider Accepting it as the solution.

Please feel free to connect with me.
Mariusz Repczynski

 

 

ermak
Frequent Visitor

Hello, @Mariusz !

Thank you very much, but it only works if the dates are in order, for example 01.02.2020, 02.02.2020, 03.02.2020, etc. But it doesn't work if the dates are spaced, for example, 01.02.2020, 13.02.2020, 28.02.2020.

 

Is there any way to fix this?

Mariusz
Community Champion
Community Champion

Hi @ermak

 

I've updated the formula on the attached.

 

Best Regards,
Mariusz

If this post helps, then please consider Accepting it as the solution.

Please feel free to connect with me.
LinkedIn

 

Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

Vote for your favorite vizzies from the Power BI World Championship submissions!

Sticker Challenge 2026 Carousel

Join our Community Sticker Challenge 2026

If you love stickers, then you will definitely want to check out our Community Sticker Challenge!

January Power BI Update Carousel

Power BI Monthly Update - January 2026

Check out the January 2026 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.