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

The Power BI Data Visualization World Championships is back! It's time to submit your entry. Live now!

Reply
jobrock
Frequent Visitor

How can we compare dynamic header column

Hi

How can we compare column - my condition is

1. Mark cells red if the cost per lead is 20% higher then the day before

2. Mark cells red if Lead per day is 0 and Cost per day is 0.

question.png

1 ACCEPTED SOLUTION
v-juanli-msft
Community Support
Community Support

Hi @jobrock 

Please pay attention to this formula

previous value =
CALCULATE (
    SUM ( Table1[value] ),
    FILTER (
        ALLSELECTED ( Table1 ),
        Table1[client] = MAX ( Table1[client] )&&Table[spend]=MAX(Table[spend])&&Table[day]=MAX(Table[day])&&...
            && Table1[metric] = "cost per lead"
            && Table1[date]
                = MAX ( Table1[date] ) - 1
    )
)

add any columns in the "Row" fields of the matrix in the red part.

 

 

Best Regards
Maggie

 

Community Support Team _ Maggie Li
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

2 REPLIES 2
v-juanli-msft
Community Support
Community Support

Hi @jobrock 

Please pay attention to this formula

previous value =
CALCULATE (
    SUM ( Table1[value] ),
    FILTER (
        ALLSELECTED ( Table1 ),
        Table1[client] = MAX ( Table1[client] )&&Table[spend]=MAX(Table[spend])&&Table[day]=MAX(Table[day])&&...
            && Table1[metric] = "cost per lead"
            && Table1[date]
                = MAX ( Table1[date] ) - 1
    )
)

add any columns in the "Row" fields of the matrix in the red part.

 

 

Best Regards
Maggie

 

Community Support Team _ Maggie Li
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

v-juanli-msft
Community Support
Community Support

Hi @jobrock 

Create measures

previous value =
CALCULATE (
    SUM ( Table1[value] ),
    FILTER (
        ALLSELECTED ( Table1 ),
        Table1[client] = MAX ( Table1[client] )
            && Table1[metric] = "cost per lead"
            && Table1[date]
                = MAX ( Table1[date] ) - 1
    )
)

pre_vs_cu =
VAR per =
    ( SUM ( Table1[value] ) - [previous value] ) / [previous value]
RETURN
    IF ( [previous value] <> BLANK (), per )

color flag1 = IF([pre_vs_cu]>0.2&&MAX(Table1[metric])="cost per lead",1,0)

color flag 2 = IF(SUM(Table1[value])=0&&MAX(Table1[metric])in {"cost per lead","lead per day"},1,0)

final flag = IF([color flag1]=1||[color flag 2]=1,1,0)

1.png

2.png

 

Best Regards
Maggie

 

Community Support Team _ Maggie Li
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

The Power BI Data Visualization World Championships is back! It's time to submit your entry.

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.