Forum Discussion
ssvr
8 years agoHelper III
DAX: Date Difference required with New Measure
Hi, Can you help me out with this query One of my mate share dis DAX (Measure) for date diffarece. But i got some errors with query can you fix this [ClosedDt-CreatedDt] Daydiff = VAR Cr...
- Anonymous8 years ago
Daydiff = VAR Created = MAX ( 'Dates'[CreatedDt] ) VAR Closed = MAX ( 'Dates'[ClosedDt] ) VAR NoOfDays = IF ( Closed > Created, DATEDIFF ( Created, Closed, DAY ), DATEDIFF ( Closed, Created, DAY ) ) RETURN IF ( NoOfDays >= 21, "Met SLA", "NotMet SLA" )Just created another variable called NoOfDays with the calculation you wanted, then use it in the other if statement
- Anonymous7 years ago
ssvr, this should do it
DDiff_DueDateCloDate = VAR Due = INT( MAX ( 'Task'[DueDate] ) ) VAR Clos = INT( MAX ( 'Task'[ClosedDate] ) ) RETURN Due - Clos
INT() will convert a date into an integer.
Then you simply subtract one number from the other. This will make the result show a negative number, and should be the fastest performance-wise.
ssvr
7 years agoHelper III
Thank you so much Anonymous DAX Master :-)
ssvr
7 years agoHelper III
Hi Anonymous,
One doubt from my end. Its a new one :-)
While applying below DAX i got one error.,
truecondiation = IF(ISM[OData_{CH} Recommend0]=BLANK(),ISM[OData_{RNSP} TSS_x00],ISM[OData_{CH} Recommend0])
Expressions that yield variant data-type cannot be used to define calculated columns.
Can you fix this for me.