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

Don't miss out! 2025 Microsoft Fabric Community Conference, March 31 - April 2, Las Vegas, Nevada. Use code MSCUST for a $150 discount. Prices go up February 11th. Register now.

Reply
Anonymous
Not applicable

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):

lll.PNG

 

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:

11111.PNG

Thanks.

1 ACCEPTED SOLUTION
dax
Community Support
Community Support

Hi @Anonymous , 

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.

Please do mask sensitive data before uploading.

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.

View solution in original post

4 REPLIES 4
amitchandak
Super User
Super User

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

ShowItemwithoutdata.JPG

Join us as experts from around the world come together to shape the future of data and AI!
At the Microsoft Analytics Community Conference, global leaders and influential voices are stepping up to share their knowledge and help you master the latest in Microsoft Fabric, Copilot, and Purview.
️ November 12th-14th, 2024
 Online Event
Register Here
Anonymous
Not applicable

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

ssss.PNG

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.

 

Thank you for your help

Anonymous
Not applicable

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

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

dax
Community Support
Community Support

Hi @Anonymous , 

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.

Please do mask sensitive data before uploading.

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.

Helpful resources

Announcements
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!

Jan25PBI_Carousel

Power BI Monthly Update - January 2025

Check out the January 2025 Power BI update to learn about new features in Reporting, Modeling, and Data Connectivity.

December 2024

A Year in Review - December 2024

Find out what content was popular in the Fabric community during 2024.