Conditional days between dates (based on previous rows)

kcmuppet

Active Member
Joined
Nov 2, 2005
Messages
437
Office Version
  1. 365
Platform
  1. Windows
Hello,

I'm new to Power Pivot Power BI and would appreciate some help trying to work out a Calculated column or Measure that is a conditional count of days like the example in the picture

I need a count of days...
... if the Name matches a Name already in the column and...
... since the last "Event type A" for that matched Name

1607347652038.png


I can't much past "=if ( [Name] = [@Name] , if ( [@Event] <> "Event type A", ....

Would greatly appreciate somebody pointing me in the right direction
 

Excel Facts

What does custom number format of ;;; mean?
Three semi-colons will hide the value in the cell. Although most people use white font instead.
I'm thinking the calculation needs to be a MAX value, filtered? Something like: 'Find the max date date by filtering the Event and Name , where the name 'equals the Name on the current row.'

So to start with I'm trying to work out what the effective equivalent in DAX is of the "@" in an Excel table. Is it right that I can use the EARLIER function?

I'm not getting very far with this:


=calculate(MAX(tbl_Events[Event date]),FILTER(ALL(tbl_Events), tbl_Events[Name] = EARLIER(tbl_Events[Name]))


Any tips greatly appreciated.

(Now cross-posted here)
 
Upvote 0

Forum statistics

Threads
1,215,032
Messages
6,122,772
Members
449,095
Latest member
m_smith_solihull

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top