cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Helper III
Helper III

Finding previous date's value in one column based on another column

Hello everyone,

 

I really got stuck with this one. I can't find any help for the PREVIOUSDAY function. I need to add a column with the previous date's value for a certain value in another column. My dates are not continuous. Example:

Segment             Date        UniqueOpenRate
WiFi                    1/3/2020 15%
Hotel concierge 1/3/2020 14%
WiFi                    2/3/2020 16%
Hotel Concierge 2/3/2020 13%

 

I need to be able to add a new column where I set the previous value for each Segment:

Segment            Date        PrevOpenRate
WiFi                   2/3/2020 15%

 

How can I do that?
Thanks!
Stan

1 ACCEPTED SOLUTION

This works! Thank you so much! Yuu saved me so much time!

View solution in original post

2 REPLIES 2
Super User II
Super User II

Hi @zaichusha 

try Measure

Measure = 
var _curDate = MAX('Table'[Date])
var _prevDate = CALCULATE(MAX('Table'[Date]), ALLEXCEPT('Table','Table'[Segment]),'Table'[Date] < _curDate)

RETURN

CALCULATE(SUM('Table'[UniqueOpenRate]), FILTER(ALLEXCEPT('Table','Table'[Segment]),'Table'[Date] = _prevDate))

 


do not hesitate to give a kudo to useful posts and mark solutions as solution
LinkedIn

This works! Thank you so much! Yuu saved me so much time!

View solution in original post

Helpful resources

Announcements
secondImage

Congratulations!

We are excited to announce the Power BI Super Users!

Wave Release 2

Check out the updates in Power BI.

Overview of Power BI 2020 release wave 2!

Microsoft Ignite

Microsoft Ignite

Join digitally, March 2–4, 2021 to explore new tech that's ready to implement. Experience the keynote in mixed reality through AltspaceVR!

secondImage

The largest Power BI virtual conference

100+ sessions, 100+ speakers, Product managers, MVPs, and experts. All about Power BI. Attend online or watch the recordings.