Forum Discussion
DaniBi92
5 years agoNew Member
DATEDIFF with values in different Rows and Fields
Hi, is it possible to use a DATEDIFF formulas with values in different Rows and Fields(or another DAX formulas)? For example, i 've the following Data: ITEM STATUS DATE1 DATE2 XXX...
Fowmy
Super User
5 years agoDaniBi92
You can create a DX table with the following code. Click New Table under the Modeling tab and paste the code given below, rename the table name as per yours.
Result Table =
ADDCOLUMNS(
ADDCOLUMNS(
VALUES(Table1[ITEM]),
"DATE1", CALCULATE(MIN(Table1[DATE1])),
"DATE2", CALCULATE(MIN(Table1[DATE2]))
),
"RESULT", DATEDIFF([DATE1],[DATE2],DAY)
)