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

Compete to become Power BI Data Viz World Champion! First round ends August 18th. Get started.

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
bnjmnnl
Helper III
Helper III

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
August Power BI Update Carousel

Power BI Monthly Update - August 2025

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

August 2025 community update carousel

Fabric Community Update - August 2025

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

Top Solution Authors