Forum Discussion
PowerBIUser9901
7 years agoAdvocate II
DateDiff with repeating Order ID's
Hi, I’m looking to calculate the difference between two dates in Power BI. I’m aware this is possible with DATEDIFF in DAX however the data I have contains repeating Order ID’s for each Product assoc...
- 7 years ago
Hi PowerBIUser9901 ,
You need to create a new measure:
NetAvg = AVERAGEX ( VALUES ( 'Table'[Order_ID] ), CALCULATE ( AVERAGE ( 'Table'[Column] ) ) )Best Regards,
Eads
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Anonymous
7 years agoNot applicable
Hi PowerBIUser9901 ,
Follow these steps:
Add this calculated new table:
Table 3 =
SUMMARIZECOLUMNS(
'Date diff'[Order ID] ,
"OD",Max('Date diff'[Order Date ]),
"SD",MAx('Date diff'[Ship Date]),
"Date Diff" , DATEDIFF(Max('Date diff'[Order Date ]),Max('Date diff'[Ship Date]), DAY)
)Create a relationship between your existing Table and a new Table by linking the Order ID.
now put the Fields in the Table Visual:
My Output:
Let me know if this works.
Thanks,
Tejaswi