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

Enhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.

Reply
EpicTriffid
Helper IV
Helper IV

Format background of blank cells in matrix

Hello all!

 

The problem:

 

I am trying to get all cells specified as Actuals im the below matrix to have a grey background colour. Just for differentiation. However, I can't just default them to having zero as a zero means something different from the blank in this dataset. 

 

Capture.PNG

 

The code for what I've got so far is fine for colouring in figures with actuals, but getting those blank cells under actuals filled in is boggling my brain.

 

Q2 Actuals BG = 
IF(
    SELECTEDVALUE(Query2[Forecast/Actuals]) = "Actuals", "#d3d3d3")

 

Any help?

8 REPLIES 8
EpicTriffid
Helper IV
Helper IV

Is there any help on this? I feel like I've dealt with blanks before in a matrix but cannot remember what I did?

EpicTriffid
Helper IV
Helper IV

Hi @v-zhangti 

 

Unfortunately that doesn't work either as the format of the data is closer to:

 

Capture3.PNG

 

So the matrix is inferring the context of data with missing years and putting a blank in it's place, generating the below.

 

0a3021d6-b05e-4a9c-8844-de9e84c93379.png

 

Using the same logic in my measures of only colouring in "Actuals" as grey still gives me the below. I can't seem to select those blanks under Actuals using DAX to make them colour grey.

 

Capture4.PNG

 

Does that make sense?

 

 

 

v-zhangti
Community Support
Community Support

Hi, @EpicTriffid 

 

You can try the following methods.
Sample data:

vzhangti_0-1666677344444.png

Color = IF(
    SELECTEDVALUE('Table'[Forecast/Actuals]) = "Actuals", "#d3d3d3")

vzhangti_1-1666677383187.png

Measure = SUM('Table'[Value])+0

vzhangti_2-1666677432205.png

 

Best Regards,

Community Support Team _Charlotte

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

EpicTriffid
Helper IV
Helper IV

I can get quite close to this but i just can't seem to make the conditional formatting affect the blank cells:

 

Capture1.PNG

I also know that technically, in the table operating behind this matrix that essentially there are no rows that relate to the blank cells, so I'm trying to make Power BI only affect what is technically "missing" from the data, but I don't know how to get there!

Anonymous
Not applicable

hello please try:

Conditional Formatting =
VAR SelectedActual = 
    SELECTEDVALUE(Query2[Forecast/Actuals])
VAR Table =
    CALCULATETABLE (
        Table,
        REMOVEFILTERS (
            //All your dates example
            Table[Date],
            Table[Month]
        )
    )
VAR summaryof =
    SUMMARIZE ( Table, [Date], "Actual Forcast", [amount of all actual and forcast] )
VAR T3 =
    FILTER ( summaryof, SelectedActual  = "Actuals" )

RETURN
    IF(
    T3, "#d3d3d3")
Anonymous
Not applicable

Hello 

Var table is making sure all values are selected

Var summary is summarizing the table with your measure

Var t3 is filtering the summarized table into only actuals

 

Hi @Anonymous 

 

Unfortunately that doesn't work. It still does not show any formatting of the background against any blank values.

Hey! Thanks for the reply and your time! I'm afraid I can't implement this as I'm not entirely sure what it's doing?

Helpful resources

Announcements
July 2025 community update carousel

Fabric Community Update - July 2025

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

July PBI25 Carousel

Power BI Monthly Update - July 2025

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

Join our Fabric User Panel

Join our Fabric User Panel

This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.