Check your eligibility for this 50% exam voucher offer and join us for free live learning sessions to get prepared for Exam DP-700.
Get StartedDon't miss out! 2025 Microsoft Fabric Community Conference, March 31 - April 2, Las Vegas, Nevada. Use code MSCUST for a $150 discount. Prices go up February 11th. Register now.
I have the following measure that works if I choose 'NC Main'[NC Completed Date] yet fails when I substitute 'NC Main'[NC Created Date]. The Created Date field just produces (BLANK). The two columns are identical in terms of formats and data type. I have tried not using DATEDIFF and just subtracting the dates and I get the same results; Completed works and Created gives (BLANK). I'm trying to figure out how to get a model assembled without PII or propriatary info. I have created multiple colums that breaks this measure down into smaller bits and all of those work on Created Date.
Does any one have any ideas where I can start troubleshooting?
Measure that is hosed
Column Calculation that works
Solved! Go to Solution.
Do you have a separate Calendar Table by a chance? If yes, by which date is it linked to your fact table?
@boyddt_mn Hello,
Maybe try the below code:
__TestAged =
VAR MaxDate = CALCULATE(MAX('datekey'[date]))
RETURN
IF(
[__TestStatus] = "open" &&
[__Test Created in RP] = "Valid" &&
NOT ISBLANK('NC Main'[NC Created Date]) &&
DATEDIFF('NC Main'[NC Created Date], MaxDate, DAY) > 60,
"aged",
"not aged"
)
where,
NOT ISBLANK('NC Main'[NC Created Date]): Prevents errors caused by blank dates
l Would suggest to check for
@rit_ty7thank you for your input. Created Date will never be null or blank because the record cannot be created without it. Completed Date does have blanks and it works as expected. I've checked the formatting for all four date columns and they all appear to be consistent. The first screenshot is from the Transform window where the date fields are initially created from a Date/Time field, they all show as data type Date. The second screenshot is from the table view, showing roughly the same thing. You'll notice that the far left columns are test columns and the code is included. Everything works when using the Created Date in creating columns. Here is the code for some of those columns
__TestAged =
VAR MaxDate = MAX('datekey'[date])
RETURN
IF(
[__TestStatus] = "open" &&
[__Test Created in RP] = "valid" &&
MaxDate - 'NC Main'[NC Created Date] > 60,
"aged",
"not aged"
)
__Test Created in RP = IF('NC Main'[NC Created Date]<=DATE(2024,11,24),"Valid","Not Valid")
Do you have a separate Calendar Table by a chance? If yes, by which date is it linked to your fact table?
@AgataJfollowing your thought process I checked my relationships. Interestingly enough if I make the active connection inactive the measures work. I'm still not sure why this should create such chaos but at least I have a 'fix' for now.
Thankyou
Hi @boyddt_mn ,
I'm glad you fixed the issue, and I am confused a bit as well. It's quite tricky to use two dates in one DAX measurement. USERRELATIONSHIP might be useful for inactive relationship.
Kind regards,
Agata
Yes, I have a date table 'DateKey' and 'nc main'[nc created date] is linked to 'datekey'[date]. there is a secondary link between [date] and [nc completed date].
March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount! Prices go up Feb. 11th.
Check out the January 2025 Power BI update to learn about new features in Reporting, Modeling, and Data Connectivity.
User | Count |
---|---|
144 | |
85 | |
65 | |
51 | |
45 |
User | Count |
---|---|
217 | |
88 | |
81 | |
65 | |
56 |