Power BI is turning 10, and we’re marking the occasion with a special community challenge. Use your creativity to tell a story, uncover trends, or highlight something unexpected.
Get startedJoin us for an expert-led overview of the tools and concepts you'll need to become a Certified Power BI Data Analyst and pass exam PL-300. Register now.
Hi,
There could be a suggestion for this elsewhere, but I've been searching for a while and not found anything! I pull an export from a system every week, the spreadsheet is named the date of the export and it's saved in a folder. Power BI uses that folder as the data source and the source name is converted into a date within the query.
Each row in the export has a unique ID and a value alongside it. I have created a matrix which looks similar to the below:
Export Date 31st July 2019 31st August 2019 30th September 2019 31st October 2019
Unique ID m MB Usage MB Usage MB Usage MB Usage
123456 205 303 210 300
112233 201 200 210 211
232123 101 100 500 400
534234 650 300 250 241
I'm wanting to create a measure that will fit in between each column and work out the difference between one date's value and the other.
There is actually more data than these included dates because a sheet is exported every week, but I have the visual only look at the last date of each month.
Many thanks in advance.
So, I would expect that would be something along the lines of:
Measure 1 = CALCULATE([Measure],PREVIOUSMONTH('Dates'[Date]))
Or you could brute force it similar to:
Measure 1 =
VAR __Date = MAX('Table'[Date])
VAR __Year = YEAR(__Date)
VAR __Month = MONTH(__Date)
VAR __Day = DAY(__Date)
VAR __PreviousDate =
IF(__Month = 1,DATE(__Year - 1,12,__Day),DATE(__Year,__Month-1,__DAy))
RETURN
CALCULATE([Measure],'Table'[Date] = __PreviousDate)
Hi Greg,
Thanks for your quick response. Have I understood you correctly by using this measure for the first example:
Hi , @EuanKonnektis
There's nothing wrong with @Greg_Deckler solution.
I suspect you didn't use the correct calendar table.
"Previousmonth" is a time intelligence function that needs to be used with the calendar table of consecutive date columns.
Best Regards,
Community Support Team _ Eason
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
I do still seem to be having issues with this and "Difference" is currently returning a blank field.
I have another table called 'App Usage' which has a date row that runs every day of the month (between 02-06-2019 to today).
I have set up a relationship between 'Data Usage'[Export Date] and 'App Usage'[Date].
Is there still something I'm missing? Apologies, I'm still getting used to this!
Here is how it looks now:
Hi @v-easonf-msft - ahhh, fantastic, I see! My export date only has a date every week.
So do I need to have a consecutive date calendar date table that has a relationship with the export date column?
Many thanks,
Euan.
This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.
Check out the June 2025 Power BI update to learn about new features.
User | Count |
---|---|
65 | |
63 | |
52 | |
37 | |
36 |
User | Count |
---|---|
82 | |
67 | |
61 | |
46 | |
45 |