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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

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!

eliasayy
Impactful Individual
Impactful Individual

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")
eliasayy
Impactful Individual
Impactful Individual

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 @eliasayy 

 

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
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

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