Forum Discussion
data23f
Helper I
6 years agoFind the date difference for a single column
Hi, I have a Date field in a table. My goal is to create a new column that calculates the date difference from the previous date in # of days. For example: • 1/17/20 an...
- 6 years ago
data23f
Helper I
6 years agoI'm trying to attach a sample power bi .pbix file but I don't see the option to.
How do I attach a file?
HotChilli
Community Champion
6 years agoDropbox or similar and post the link
- data23f6 years ago
Helper I
HotChilli I don't want to share a folder which perhaps can have confidential information. So instead, I'm sticking with the screenshot. The data is very simple.
This is done in Excel and in the Output field it's calculating the # of days difference from the previous date.
The slicer just had a way of segmenting the data from Country, Region. But I should be able to incorporate this once the new column is calculated.
Hope this helps.
- HotChilli6 years ago
Community Champion
A column for the simple example
ColumnA = VAR _date = TableCats[Date] VAR _prevDate = CALCULATE(MAX(TableCats[Date]), FILTER(TableCats, TableCats[Date] < _date)) RETURN DATEDIFF(_prevDate, _date , DAY)For future posts, please post data directly (you can paste it into the post) or anonymise the data and link a pbix
- Ashish_Mathur6 years ago
Super User