Forum Discussion
Date DAX Calculation
Hi Amitkr174
I can tell that [CreatedDate] and [Case_Comp_date] are columns not measures and [Comp_Created_datediff] is a calculated column (summarized by sum) and not a measure as the total sums the individual values of the rows. Please confirm. I can also notice that both date columns are of text data type as they are alligned left.
However, what is confusing me is how the subtraction is actually calculating correct difference. Do you have other date columns of date data type?
- Amitkr1743 years ago
Helper III
Yes, columns [CreatedDate] and [Case_Comp_date] are not measures. [Comp_Created_datediff] is a measure DAX is -
IF([CreatedDate]>[Case_Comp_date],
[CreatedDate]-[Case_Comp_date], BLANK())Could you please let me know how to check for a date column, if the following date is greater or lesser from the previous date?- tamerj13 years ago
Community Champion
[Comp_Created_datediff] is most likely a calculated column. Please double check. The DAX that you have provided would result in an error if used in a measure.
It is important to have accurate information about the problem in order to be able to solve it.- Amitkr1743 years ago
Helper III
DR# ID CaseNumber CreatedDate Case_Comp_date Comp_Created_datediff oldvalue Newvalue DR3622342 0065Y00001hNJCNQA4 2197519 2/15/2023 2/26/2023 02 - Prospect 05 - Solution Definition and Validation DR3622342 0065Y00001hNJCNQA4 2197519 1/14/2023 2/26/2023 02 - Prospect 05 - Solution Definition and Validation DR3622342 0065Y00001hNJCNQA4 2197519 3/8/2023 2/26/2023 10 02 - Prospect 05 - Solution Definition and Validation DR3622342 0065Y00001hNJCNQA4 2197519 5/25/2023 2/26/2023 05 - Solution Definition and Validation 06 - Customer Commit DR3622342 0065Y00001hNJCNQA4 2197519 5/26/2023 2/26/2023 06 - Customer Commit Closed - Booked DR3622342 0065Y00001hNJCNQA4 2197519 5/26/2023 2/26/2023 Closed - Booked 07 - Execute to Close DR3622342 0065Y00001hNJCNQA4 2197519 6/1/2023 2/26/2023 07 - Execute to Close Closed - Bookedyes, you are correct, it is a calculated measure. Attached is the sample date.
Condition is - if Createddate>Case Comp date, then Createddate-Case Comp date, else Null.
Rest of the rows should show blank values.