Join us at FabCon Atlanta from March 16 - 20, 2026, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.
Register now!Calling all Data Engineers! Fabric Data Engineer (Exam DP-700) live sessions are back! Starting October 16th. Sign up.
Need a little DAX help. I have a transactions table (the many side) with transaction dates. And I have a customer table (the one side) with just one date per customer. I can probably do a calculated column to find the number of days between transaction date and "customer date". But I can't figure it out using a measure. Here is my attempt below:
CALCULATE
(SUMX(TransactionsTable,
DATEDIFF(
RELATED(CustomerTable[Cust_Date]),TransactionsTable[Transaction_Date],DAY)),
Transactions[LateType]="Late")
I keep getting an error about start date cannot be greater than end date. I may have situtations though where that exists or where there is no customer date or no customer found. I believe I would want to exclude such cases.
@robarivas wrote:
Need a little DAX help. I have a transactions table (the many side) with transaction dates. And I have a customer table (the one side) with just one date per customer. I can probably do a calculated column to find the number of days between transaction date and "customer date". But I can't figure it out using a measure. Here is my attempt below:
CALCULATE
(SUMX(TransactionsTable,
DATEDIFF(
RELATED(CustomerTable[Cust_Date]),TransactionsTable[Transaction_Date],DAY)),
Transactions[LateType]="Late")
I keep getting an error about start date cannot be greater than end date. I may have situtations though where that exists or where there is no customer date or no customer found. I believe I would want to exclude such cases.
Could you post any sample data in your case? Even better you can share a pbix file.
You just need to wrap your measure in a SWITCH or IF argument, with the conditions being if start date < end date, do X, otherwise if start date > end date, do Y.
X is what you already have, Y would be the same thing but with the order of the dates in the DATEDIFF reversed. Depending on your use case, you may need to multiply that by -1 to reflect the DATEDIFF is not the same as in the usual case.
Join the Fabric FabCon Global Hackathon—running virtually through Nov 3. Open to all skill levels. $10,000 in prizes!
Check out the October 2025 Power BI update to learn about new features.