cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
Frequent Visitor

Conditional formatting

Hi all,

 

I have a table like this:

 

Boat          Date         Status

A         15/07/2020       2

A         16/07/2020       1

A         17/07/2020       2

B         15/07/2020       1

B         16/07/2020       2

B         17/07/2020       1

 

How can I add a new calculated column showing in each row the status of the same boat in the previous day, showing as follows:

 

Boat          Date         Status     Status Day Before

A         15/07/2020       2                       -

A         16/07/2020       1                      2

A         17/07/2020       2                      1

B         15/07/2020       1                       -

B         16/07/2020       2                      1

B         17/07/2020       1                      2

 

Thanks!

1 ACCEPTED SOLUTION

Accepted Solutions
Highlighted
Super User IX
Super User IX

Re: Conditional formatting

@planning - Try:

 

Status Day Before =
  VAR __DayBefore = MAXX(FILTER('Table',[Date] = EARLIER('Table'[Date]) - 1 && [Boat] = EARLIER('Table'[Boat])),[Status])
RETURN
  __DayBefore

---------------------------------------

Not link spamming! If I posted a link in reply it is because I did assume you know how to search the web but thought it was the fastest way to fix your issue.

I have a NEW book! 
DAX Cookbook from Packt
Over 120 DAX Recipes!




Did I answer your question? Mark my post as a solution!

Proud to be a Super User!




View solution in original post

2 REPLIES 2
Highlighted
Super User IX
Super User IX

Re: Conditional formatting

@planning , As new column

//continous day

Last day value = maxx(filter(Table, [date] = earlier([date]) -1 && [Boat] = earlier([Boat])),[Status])

 

// noncontinous day

Last day value =
var _max = maxx(filter(Table, [date] < earlier([date]) && [Boat] = earlier([Boat])),[date])
return
maxx(filter(Table, [date] = _max && [Boat] = earlier([Boat])),[Status])

 

for measure for same case find measure here

https://medium.com/@amitchandak.1978/power-bi-day-intelligence-questions-time-intelligence-5-5-5c324...



Did I answer your question? Mark my post as a solution! Appreciate your Kudos!!
Dashboard of My Blogs !! YouTube Channel !! Connect on Linkedin

Proud to be a Super User!

Highlighted
Super User IX
Super User IX

Re: Conditional formatting

@planning - Try:

 

Status Day Before =
  VAR __DayBefore = MAXX(FILTER('Table',[Date] = EARLIER('Table'[Date]) - 1 && [Boat] = EARLIER('Table'[Boat])),[Status])
RETURN
  __DayBefore

---------------------------------------

Not link spamming! If I posted a link in reply it is because I did assume you know how to search the web but thought it was the fastest way to fix your issue.

I have a NEW book! 
DAX Cookbook from Packt
Over 120 DAX Recipes!




Did I answer your question? Mark my post as a solution!

Proud to be a Super User!




View solution in original post

Helpful resources

Announcements

August Community Highlights

Check out a full recap of the month!

August 2020 CYST Challenge

Check out the winners of the recent 'Can You Solve These?' community challenge!

Experience what’s next for Power BI

Join us for an in-depth look at the new Power BI features and capabilities at the free Microsoft Business Applications Launch Event.

Top Kudoed Authors