Forum Discussion
Anonymous
3 years agoNot applicable
Last and average between dates
Hi, I am trying to replicate the following table in Power BI but am struggling with writing the DAX for calculating some of the columns. I cannot seem to get the last formal inspection date o...
FreemanZ
3 years agoSuper User
hi Anonymous
try like:
AvgDaysBetweenFormalInspections =
VAR CurrentProject =
MAX(Project[ProjectName])
VAR CurrentDate =
MAX('Date of Inspection'[date])
VAR LastInspection =
CALCULATE(
MAX('Date of Inspection'[date]),
FILTER(
ALL(Project),
Project[ProjectName] = CurrentProject &&
'Date of Inspection'[date]< CurrentDate
)
)
RETURN
IF(
LastInspection = BLANK(),
BLANK(),
CurrentDate - LastInspection
)
- Anonymous3 years agoNot applicable
Hi,
Unfortunately it didn't work, it is now returning all rows as 30/12/1899.