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

Data Days is here! Join us now for 60+ days of learning, challenges, and connection. Learn more

Reply
bodnaran
Regular Visitor

Conditional format based on coverage date

Hello guys,

 

I am struggling for a while to reproduce an excel type matrix in Power BI.

 

bodnaran_0-1694002116678.png

The input from the users is not comming every day, it is made once a week.

I have a date table which is covering the whole year (01.01.2023 -31.12.2023). In this table I have the following columns:

bodnaran_1-1694002276675.png

 

My facts table is like below:

 

CoverageDay of Year for CoverageDay of Year for TodayProject_nameCustomer_namePlant_nameInt_extUpdate_dateWeek of YearPlant IDCustomer IDProject ID
29-09-2023272249111123Ext05-09-2023362512
08-09-2023251249222234Ext05-09-2023362511
18-09-2023261249333345Ext04-09-2023364715
26-09-2023269249444456Int04-09-202336122
26-09-2023269249555567Int04-09-202336127
26-09-2023269249666678Ext04-09-202336139
08-09-2023251249777789Int04-09-202336124
08-09-2023251249888900Int04-09-202336125
24-10-20232972499991011Int04-09-202336126
07-11-2023311249101101122Int04-09-202336128
27-11-2023331249111211233Int04-09-202336149
29-09-2023272249121321344Ext04-09-2023361310
07-09-2023250249131431455Ext04-09-2023363513
18-09-2023261249141541566Ext04-09-2023364614
28-11-2023332249151651677Int04-09-202336111
27-10-2023300249161761788Int04-09-202336145
11-09-2023254249171871899Ext04-09-2023364816
02-10-2023275249181982010Int28-08-202335123

 

In the end I need a matrix which needs to look like the "excel" example above. I tried to use some function that shows me the "green" until the coverage day but I get red only on the day of coverage like below:

 

bodnaran_2-1694002677507.png

DAX codes I tried

 

 

IsAllSmaller = 
IF (
    COUNTROWS (
        FILTER (
            F_CustomerUpdate,
            F_CustomerUpdate[Day of Year for Coverage]
                >= MAX ( F_CustomerUpdate[Day of Year])
        )
    )=0,
    "Green",
    "Red"
)

 

 

 

 

Test = 
SWITCH(
    TRUE(),
    SELECTEDVALUE(F_CustomerUpdate[Day of Year for Coverage])=BLANK(),0,
    SELECTEDVALUE(F_CustomerUpdate[Day of Year for Coverage]) > SELECTEDVALUE(F_CustomerUpdate[Day of Year]), 1 , 
    SELECTEDVALUE(F_CustomerUpdate[Day of Year for Coverage]) )

 

 

Any idea how can I show Green until the coverage day and red after the coverage day?

1 REPLY 1
Anonymous
Not applicable

Wouldn't the following work?:

IF(
date <= coverage, "green", "red"
)

This would make all dates before and on coverage date show green and everything after red. 


Helpful resources

Announcements
Fabric Data Days is here Carousel

Fabric Data Days 2026

Don't miss out on Data Days, June 15 through August 7. Learn Fabric, Power BI, SQL, AI and more.

May Power BI Update Carousel

Power BI Monthly Update - May 2026

Check out the May 2026 Power BI update to learn about new features.

Power BI DataViz World Championships carousel

Power BI DataViz World Championships - June 2026

A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.