Reply
Regular Visitor
Posts: 40
Registered: ‎09-06-2017
Accepted Solution

Shift Date by a number of days

hi,

 

this has a simple problem; however, my mind is wandering around and couldn't find a solution for that.

I have a measure A = sum(Values) by date

 

and I want to calculate measure B = Measure A shifted 3 days earlier.

 

tried: calculate(A, filter(Date table, Date = Date -3)), but it doesn't work.

any helps pls?

Thanks


Accepted Solutions
Highlighted
Super User
Posts: 1,627
Registered: ‎07-03-2015

Re: Shift Date by a number of days

try this

 

calculate(A, filter(Date table, Date = lastdate(Date) -3))

* Matt is a Microsoft MVP (Power BI) and author of the Power BI Book Supercharge Power BI.

View solution in original post


All Replies
Highlighted
Super User
Posts: 1,627
Registered: ‎07-03-2015

Re: Shift Date by a number of days

try this

 

calculate(A, filter(Date table, Date = lastdate(Date) -3))

* Matt is a Microsoft MVP (Power BI) and author of the Power BI Book Supercharge Power BI.
Community Support Team
Posts: 4,002
Registered: ‎07-09-2016

Re: Shift Date by a number of days

@Iamnvt,

 

To shift either forward or backward in time by the specified number of intervals from the dates, you may take a look at DATEADD Function.

Community Support Team _ Sam Zha
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.