Forum Discussion
DATEDIFF DAX measure
- 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.
Good morning
Is it possible to create a measure with the DATEDIFF form using two date fields within the source table?
I am trying to calculate an indicator for invoices with start and end date with reference to the accumulated of a column (consumption), which adds the previous consumption data and I must divide it by the number of days that arises from the invoice period. I have the column of number of days created with the DATTEDIF forula but I skip the error when creating the indicator.
I do not know if the error is that. that a measure is necessary.
Thank you very much in advance.
Greetings