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

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

Reply
MHTANK
Helper III
Helper III

Previous Day Value

DateVALUE
01-11-2024        126
02-11-2024        494
08-11-2024        78
08-11-2024        88
25-11-2024        98
30-11-2024        108
02-12-2024        118
03-12-2024        128
06-12-2024        100
06-12-2024        90
28-12-2024        200
31-12-2024        110
01-01-2025        20
02-01-2025        84
03-01-2025        145
07-01-2025        25

This is my Data.


From that I want to create one matrix with previous day value.

i.e.,

want result.png

Here,

TOTAL_VALUE = SUM(Sheet1[VALUE])
Prev_Value = CALCULATE([TOTAL_VALUE], Sheet1[Date].[Day] = MAX(Sheet1[Date].[Day])-1)
 
I got this aready, But problem is 
the Date are not continous, there is a different gaps between two dates. Because of this 1st problem occurs.
For example, here no value for 03-11-2024 but there is Prev_value come, but I want value of 02-11-2024 in 08-11-2024.
 
And 2nd problem is that there is blank value come for every 1st day of month, but there I want value of last day of previous month.
For example, in prev_value of 02-12-2024 I want value of 30-11-2024 .
 
So, please give me solutoin, How I can achieve this?
1 ACCEPTED SOLUTION
Ashish_Mathur
Super User
Super User

Hi,

PBI file attached.

Hope this helps.

Ashish_Mathur_0-1741663849037.png

 


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/

View solution in original post

7 REPLIES 7
Ashish_Mathur
Super User
Super User

Hi,

PBI file attached.

Hope this helps.

Ashish_Mathur_0-1741663849037.png

 


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/

Thank you so much. 👍🏻

You are welcome.


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/
ThxAlot
Super User
Super User

PREV_LASTNONBLANK = 
VAR __prev =
    CALCULATE( LASTNONBLANK( DATA[Date], 0 ), DATA[Date] < MAX( DATA[Date] ) )
RETURN
    CALCULATE( [SUM Value], DATA[Date] = __prev )
PREV_OFFSET = 
CALCULATE( [SUM Value], OFFSET( -1, ALLSELECTED( DATA[Date] ) ) )

ThxAlot_0-1741651749551.png



Expertise = List.Accumulate(


        {Days as from Today},


        {Skills and Knowledge},


        (Current, Everyday) => Current & Day.LearnAndPractise(Everyday)


)



Yes, this is work 👍🏻 in this data.

But in my original data (company's data) this is not work for the starting day of month. Can you please tell me what problems may be happening?

lbendlin
Super User
Super User

But problem is 
the Date are not continous, there is a different gaps between two dates

 

I have been using OFFSET(-1) in such scenarios recently, and I really like it. Maybe give it a try.

This is not work.

Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!

December 2025 Power BI Update Carousel

Power BI Monthly Update - December 2025

Check out the December 2025 Power BI Holiday Recap!

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.