Whilst I have read and found other ways to get the Last Dataset Refresh Date, I find that my method is a lot easier and cleaner to complete.

Creating the Last Dataset Refresh Data

Open Power BI Desktop and go into the Query Editor.

Then click on New Source and select Blank Query

Next I renamed my Blank Query from Query1 to Last Dataset Refresh

Next click on the Advanced Editor and put in the following M Code, which I will explain what it does after the code.

let

TodaysDate = DateTime.From(DateTimeZone.SwitchZone(DateTimeZone.FixedLocalNow(),10)),

#”Converted to Table” = #table(1, {{TodaysDate}}),

#”Renamed Columns” = Table.RenameColumns(#”Converted to Table”,{{“Column1”, “Last Refresh Date Time”}}),

#”Changed Type” = Table.TransformColumnTypes(#”Renamed Columns”,{{“Last Refresh Date Time”, type datetime}})

in

#”Changed Type”

What the above is doing is it is getting today’s Date and time. And this is where I created the magic on the first line.

If you have a look I have put in the Timezone that I am in. I currently am living in Brisbane which is +10 from GMT.

So as you can see from above I have put in 10 for the DateTimezone.SwitchZone, highlighted in BLUE.

The rest of the code converts it to a table, and then I rename the column and finally give it the data type of DateTime.

So the result is the following I created shown below.

I then loaded this into my Power BI Model.

Using the Last Dataset Refresh in your Power BI Reports

Now what I did was I had to create a Calculated Measure, so that I could then use the Last
Dataset Refresh Date.

Below is the Syntax that I used to create my Calculated Measure called Data Last Refreshed

Data Last Refreshed =

VALUES ( ‘Last Dataset Refresh'[Last Refresh Date Time] )

Finally I put the measure onto my report and configured it with the Card Visual and the following properties shown below.

I did this to ensure that it would take up the least amount of screen real estate as possible.

And I test it by publishing it to the Power BI Service and it displayed the correct Date and Time.

Conclusion

As you can see this is a simple and effective way to shown when the data in your Power BI Report was last updated.

Any questions or suggestions please feel free to let me know.

Leave a Reply

Your email address will not be published. Required fields are marked *