Forum Discussion
ka047
Helper I
5 years agoDATEDIFF DAX measure
I am trying to calculate the difference between 2 date fields. Both are in Fact tables & not created measures. AVERAGEX or SUMX won't work for me. Below is what I have so far, if someone could help m...
- Anonymous5 years ago
Hi ka047 ,
The SUMMARIZE function returns a summary table. If you want to calculate the difference between 2 date fields, try this:
Shipping Days = DATEDIFF ( Fact_SalesCogs[DeliveryDate], Fact_SalesCogs[ShippingDateConfirmed], DAY )If you want to create a calculated table which has Shipping Days column, try this:
New Table = SUMMARIZE ( Fact_SalesCogs, Fact_SalesCogs[SalesOrder], Fact_SalesCogs[DeliveryDate], Fact_SalesCogs[ShippingDateConfirmed], "Shipping Days", DATEDIFF ( 'Fact_SalesCogs'[DeliveryDate], Fact_SalesCogs[ShippingDateConfirmed], DAY ) )The pbix file I tested is here.
Best Regards,
Stephen Tao
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Anonymous
5 years agoNot applicable
Hi ka047 ,
Could you tell me if your problem has been solved?
If it is, kindly Accept it as the solution. More people will benefit from it.
Or you are still confused about it, please provide me with more details about your table and your problem or share me with your pbix file from your Onedrive for Business.
Best Regards,
Stephen Tao