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

Get Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Request now

Reply
Br1-981
Helper I
Helper I

Empty values in matrix

Hi,

I have a data model like this:

Br1981_0-1706125969576.png

 

I need to build a matrix:

Br1981_1-1706126007496.png

Using YEAR from Calendar

Media from DIS_Media

and SPEND ACTUAL FROM Weekly Data 

it is working properly.

If I add a Calculated Measurement to show for each row/Year the difference against the previous year:

ActualSpend_EUR_PY = IF(Weekly_Calc[ActualSpend_EUR]>0,
    CALCULATE (
    Weekly_Calc[ActualSpend_EUR],
    OFFSET (
        -1,
        ALL ( 'Calendar'[Year] ),
        ORDERBY ( 'Calendar'[Year], ASC )
    )
),0)

then:

ActualSpend_EUR_VarPY = IF([ActualSpend_EUR_PY]>0,(DIVIDE(Weekly_Calc[ActualSpend_EUR], Weekly_Calc[ActualSpend_EUR_PY])-1),0)

 

The matrix is reporting all the years from the table Calendar:

Br1981_2-1706126471018.png

 

While I would show just years where SPEND ACTUAL is more than 0, I tried using filters applied to the specific widgets.

 

Any Idea?

1 ACCEPTED SOLUTION
Anonymous
Not applicable

Hi @Br1-981 

 

Try the following dax 

ActualSpend_EUR_PY = 
CALCULATE(
    [ActualSpend_EUR], 
    DATEADD('Calendar'[Date], -1, YEAR)
)
ActualSpend_EUR_VarPY = 
IF(
    [ActualSpend_EUR_PY] > 0,
    ([ActualSpend_EUR] - [ActualSpend_EUR_PY]) / [ActualSpend_EUR_PY],
    BLANK()
)

 

 

 

Finally, to ensure that the matrix only shows years where "SPEND ACTUAL" is more than 0, you can use a visual level filter on your matrix. Here's how to apply the filter:

  1. Click on your matrix visual to select it.
  2. Go to the "Filters" pane on the right side of the Power BI Desktop interface.
  3. Under the "Visual level filters" section, find the "SPEND ACTUAL" measure.
  4. Set the filter to show only values greater than 0.

 

If I misunderstood what you meant. please provide detailed sample pbix file and the results you expect.So that I can help you better. Please remove any sensitive data in advance.

 

 

 

 

Best Regards,

Jayleny

 

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
Anonymous
Not applicable

Hi @Br1-981 

 

Try the following dax 

ActualSpend_EUR_PY = 
CALCULATE(
    [ActualSpend_EUR], 
    DATEADD('Calendar'[Date], -1, YEAR)
)
ActualSpend_EUR_VarPY = 
IF(
    [ActualSpend_EUR_PY] > 0,
    ([ActualSpend_EUR] - [ActualSpend_EUR_PY]) / [ActualSpend_EUR_PY],
    BLANK()
)

 

 

 

Finally, to ensure that the matrix only shows years where "SPEND ACTUAL" is more than 0, you can use a visual level filter on your matrix. Here's how to apply the filter:

  1. Click on your matrix visual to select it.
  2. Go to the "Filters" pane on the right side of the Power BI Desktop interface.
  3. Under the "Visual level filters" section, find the "SPEND ACTUAL" measure.
  4. Set the filter to show only values greater than 0.

 

If I misunderstood what you meant. please provide detailed sample pbix file and the results you expect.So that I can help you better. Please remove any sensitive data in advance.

 

 

 

 

Best Regards,

Jayleny

 

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

Thanks a lot for your help, now the measurement part is working well.

The only problem is with the last step because It is showing values also for 2025 (where I have no actual spend) just because It is calculating the PY one, even filtering at visual level Spend>0 i got:

Br1981_0-1706176616147.png

So I modified a bit the PY calculation:

ActualSpend_EUR_PY= IF([ActualSpend_EUR]>0,CALCULATE(
    [ActualSpend_EUR], 
    DATEADD('Calendar'[Date], -1, YEAR)
),BLANK())

and now it is working 😄 (no filtering at visual level needed):

Br1981_1-1706176969137.png

 

 

 

Helpful resources

Announcements
Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

October Power BI Update Carousel

Power BI Monthly Update - October 2025

Check out the October 2025 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.

Top Solution Authors