cancel
Showing results for
Did you mean:
Highlighted
Helper I

## Display zero when is blank in Matrix to properly do the difference in Measure

Hi, I have this measure:

``````DELTA3 =
VAR TOODAY = MAX('DATA BASE'[FECHA DE CAPTURA])
VAR YESTERDAY = MAX('DATA BASE'[FECHA DE CAPTURA]) - 1
VAR HOY = CALCULATE(SUM('DATA BASE'[Tons]),VALUES('DATA BASE'[Reduccion Stock]),'DATA BASE'[FECHA DE CAPTURA] = TOODAY)
VAR AYER = CALCULATE(SUM('DATA BASE'[Tons]),VALUES('DATA BASE'[Reduccion Stock]),'DATA BASE'[FECHA DE CAPTURA] = YESTERDAY)
RETURN
HOY - AYER``````

and displays this (I filtered the DELTA3 = 0, so only shows the days with changes):

I would like to display zeros in the blank spaces, so that it can makes the correct difference, i.e. the first total should be -0.71, not 0.71.

The raw data looks something like this:

Thanks.

1 ACCEPTED SOLUTION

Accepted Solutions
Highlighted
Community Support

## Re: Display zero when is blank in Matrix to properly do the difference in Measure

Hi @Midguel ,

I am not sure your data structure and measure, you could refer to my sample for details. If this is not what you want, please correct me and inform me more detailed information (such as your expected output and your sample data (by OneDrive for Business))? Then I will help you more correctly.

Thanks for your understanding and support.
Best Regards,
Zoe Zhi

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

4 REPLIES 4
Highlighted
Super User IX

## Re: Display zero when is blank in Matrix to properly do the difference in Measure

Try like

``````DELTA3 =
VAR TOODAY = MAX('DATA BASE'[FECHA DE CAPTURA])
VAR YESTERDAY = MAX('DATA BASE'[FECHA DE CAPTURA]) - 1
VAR HOY = CALCULATE(SUM('DATA BASE'[Tons]),VALUES('DATA BASE'[Reduccion Stock]),'DATA BASE'[FECHA DE CAPTURA] = TOODAY)
VAR AYER = CALCULATE(SUM('DATA BASE'[Tons]),VALUES('DATA BASE'[Reduccion Stock]),'DATA BASE'[FECHA DE CAPTURA] = YESTERDAY)
RETURN
(HOY - AYER)+0``````

If needed use option

Proud to be a Super User!

Highlighted
Helper I

## Re: Display zero when is blank in Matrix to properly do the difference in Measure

Hi @amitchandak , thank you for your help, it actually worked but the sum it's still not accurate

Look for example the total of the first 2 rows.

I think it's because the program do the difference and then add the zeros, is there a way for put the zeros before the calculation.

Highlighted
Helper I

## Re: Display zero when is blank in Matrix to properly do the difference in Measure

@amitchandak tried this and also display the zeros but still no accurate calculation:

((HOY+0) - (AYER+0))

Highlighted
Community Support

## Re: Display zero when is blank in Matrix to properly do the difference in Measure

Hi @Midguel ,

I am not sure your data structure and measure, you could refer to my sample for details. If this is not what you want, please correct me and inform me more detailed information (such as your expected output and your sample data (by OneDrive for Business))? Then I will help you more correctly.

Thanks for your understanding and support.
Best Regards,
Zoe Zhi

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

Announcements

#### Microsoft Ignite

This will be a conference that you do not want to miss!

#### Get Ready for Power BI Dev Camp

Don't miss the Power BI Dev Camp this week!

#### August Community Highlights

Check out a full recap of the month!

#### August 2020 CYST Challenge

Check out the winners of the recent 'Can You Solve These?' community challenge!

#### Experience what’s next for Power BI

Join us for an in-depth look at the new Power BI features and capabilities at the free Microsoft Business Applications Launch Event.

Top Solution Authors
Top Kudoed Authors