Forum Discussion
Date DAX Calculation
Hi, tamerj1
johnt75 parry2k Jihwan_Kim ThxAlot VahidDM
I am trying to create a DAX for the below case:-
IF ( (I:O createddate) > Case Completion Date), then
(I:O createddate) - Case Completion Date,
ELSE NULL)
I have created a DAX -
21 Replies
- Greg_DecklerCommunity Champion
Amitkr174 Sorry, having trouble following, can you post sample data as text and expected output?
Not really enough information to go on, please first check if your issue is a common issue listed here: https://community.powerbi.com/t5/Community-Blog/Before-You-Post-Read-This/ba-p/1116882
Also, please see this post regarding How to Get Your Question Answered Quickly: https://community.powerbi.com/t5/Community-Blog/How-to-Get-Your-Question-Answered-Quickly/ba-p/38490
The most important parts are:
1. Sample data as text, use the table tool in the editing bar
2. Expected output from sample data
3. Explanation in words of how to get from 1. to 2. - tamerj1Community Champion
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?- Amitkr174Helper 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?