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

The Power BI DataViz World Championships are on! With four chances to enter, you could win a spot in the LIVE Grand Finale in Las Vegas. Show off your skills.

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.LeanAndPractise(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
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!

FebPBI_Carousel

Power BI Monthly Update - February 2025

Check out the February 2025 Power BI update to learn about new features.

Feb2025 NL Carousel

Fabric Community Update - February 2025

Find out what's new and trending in the Fabric community.