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

Grow your Fabric skills and prepare for the DP-600 certification exam by completing the latest Microsoft Fabric challenge.

Reply
LFM
Helper I
Helper I

Calculate value for previous day in matrix

I have a matrix that shows expected exposure for years in the future. On the rows is reportdate and on the columns is the year expectation and values is exposure. Those are in the same table. I want to calculate exposure for the previous day to see how much it have changed from one date to next. How can I do that? I will incude thos values in the matrix. Can I do that with measure or do I have to make a new column? 

Skjermbilde 2024-04-10 154925.png

1 ACCEPTED SOLUTION
v-yilong-msft
Community Support
Community Support

Hi @LFM ,

Based on your problems, I create a table as you mentioned.

vyilongmsft_0-1713247613860.png

Then I put the table into the Matrix.

vyilongmsft_1-1713247692499.png

Next I create a measure and here is the DAX code.

Measure = 
SUM ( 'Table'[Exposure] )
    - CALCULATE ( SUM ( 'Table'[Exposure] ), PREVIOUSDAY ( 'Table'[Reportdate] ) )

vyilongmsft_2-1713247933999.png

 

 

 

Best Regards

Yilong Zhou

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
v-yilong-msft
Community Support
Community Support

Hi @LFM ,

Based on your problems, I create a table as you mentioned.

vyilongmsft_0-1713247613860.png

Then I put the table into the Matrix.

vyilongmsft_1-1713247692499.png

Next I create a measure and here is the DAX code.

Measure = 
SUM ( 'Table'[Exposure] )
    - CALCULATE ( SUM ( 'Table'[Exposure] ), PREVIOUSDAY ( 'Table'[Reportdate] ) )

vyilongmsft_2-1713247933999.png

 

 

 

Best Regards

Yilong Zhou

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

littlemojopuppy
Community Champion
Community Champion

@LFM try the PREVIOUSDAY() function

 

If you're looking for last date with data, try LASTNONBLANK().

Helpful resources

Announcements
RTI Forums Carousel3

New forum boards available in Real-Time Intelligence.

Ask questions in Eventhouse and KQL, Eventstream, and Reflex.

MayPowerBICarousel1

Power BI Monthly Update - May 2024

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

Top Kudoed Authors