Forum Discussion
RichBurdick
Helper I
6 years agoDATEDIFF When Usinf IF Argument
I am trying to wrote a DAX measurement where based on the text value of a column use these two date fields to calculate days. I have been able to figure out the DATEDIFF part of the measurement but ...
Greg_Deckler
Community Champion
6 years agoOK, I think that I would do something like this:
CAPA Planning Days =
VAR __RecordSource = MAX(CAPATable[Record_Source])
VAR __Status = MAX(CAPATable[Status])
RETURN
SWITCH(
TRUE(),
__RecordSource = "Audit" && __Status = "Closed-Door",DATEDIFF(MIN(CAPATable[DATE_OPENED]), MAX(CAPAPlanFirstApproval[FirstDate]), DAY),
__RecordSource = "Audit" && __Status = "Closed-Correction",DATEDIFF(MIN(CAPATable[DATE_OPENED]), MAX(CorrFirstApproval[FirstDate]), DAY),
__RecordSource = "Quaity Issue",DATEDIFF(MIN(CAPARequiredTable[DATE_PERFORMED]), MAX(CAPAPTable[CAPA_PLAN_APPROVAL_ON]), DAY),
BLANK()
)
RichBurdick
Helper I
6 years agoThank you so much for the help. I have been racking my brain for hours on this.
- Greg_Deckler6 years ago
Community Champion
Hope it worked for you!!
- RichBurdick6 years ago
Helper I
Quick follow up queston. I am seeing a problem with the calculation, is there anything special I need to do if using a Summary Table in my calculation ?