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 agoWell, if this is a measure, you are going to need to have an aggregation like MIN or MAX around your column. I think you want something like:
CAPA Planning Days =
IF(
MAX(CAPATable[Record_Source]) = “Audit”, // true/false statement
DATEDIFF(MIN(CAPATable[DATE_OPENED]), MAX(CAPAPlanFirstApproval[FirstDate]), DAY), //true
"This is the false part" //false
)- RichBurdick6 years ago
Helper I
Thanks for the response but when I enter the new argument I get the following error message: Too few arguments were passed to the IF function. The minimum argument count for the function is 2.
- RichBurdick6 years ago
Helper I
Maybe more information would help. I am trying to create a measure with the following criteria
If Record Source = Audit (DATEDIFF(MIN(CAPATable[DATE_OPENED]), MAX(CAPAPlanFirstApproval[FirstDate]), DAY)) and (DATEDIFF(MIN(CAPAtable[DATE_OPENED]), MAX(CorrFirstApproval[FirstDate]), DAY)) OR If Record Source = Quality Issue (DATEDIFF(MIN(CAPARequiredTable[DATE_PERFORMED], MAX(CAPATable[CAPA_PLAN_APPROVAL_ON]), DAY))- Greg_Deckler6 years ago
Community Champion
So that generally means there is a missing paren somewhere. I do not understand your last post at all. If the record source = audit then a datediff and another datediff? I am not understanding something. Are you adding those datediffs together?