Forum Discussion
Adding a Calculated Column (Date difference) with Values Based On Multiple Rows
- 5 years ago
jadhalaoui , Not very clear. Try a new column in DAX
Column = var _1 = maxx(FILTER('Table','Table'[Name]= EARLIER('Table'[Name]) && 'Table'[unique customer sequence] < EARLIER('Table'[unique customer sequence])),LASTNONBLANKVALUE('Table'[unique customer sequence],'Table'[pickup_requested])) return datediff(_1,[pickup_requested],hour)
It looks like you are trying to put a DAX expression in a query custom column, which is incorrect. Load your table, and then hit the New Column on the ribbon to enter your DAX column.
Regards,
Pat
Sorry if this is an amateur question - but how do I load the table the way you have just mentioned it?
Thanks
- mahoneypat5 years agoMicrosoft Employee
Here is a link that will help. Your expression looks valid (I put it in DAXformatter.com to check), but you'll have to see if it gets your desired result. You will need to add a column name when you enter it. New Column = <your expression>
https://docs.microsoft.com/en-us/power-bi/transform-model/desktop-tutorial-create-calculated-columns
Regards,
Pat