top of page

Power BI last refresh time

Writer's picture: nitin rungtanitin rungta

Updated: Nov 29, 2024

let

    Source = DateTimeZone.LocalNow(),

    #"Converted to Table" = #table(1, {{Source}}),

    #"Changed Type" = Table.TransformColumnTypes(#"Converted to Table",{{"Column1", type datetimezone}}),

    #"Renamed Columns" = Table.RenameColumns(#"Changed Type",{{"Column1", "NOW"}})

in

    #"Renamed Columns"



How to add Last Refresh Date card on Power BI


Introduction


In Power BI, displaying the last refresh time on your dashboard can significantly enhance the user experience. It allows viewers to know the most recent data available for analysis. This tutorial will guide you through the steps to create a Date Time Card that shows the last refresh time in Power BI.


Step-by-Step Guide


Step 1: Open Power BI and Go to Transform Data

First, open your Power BI desktop application. Navigate to the “Transform Data” option in the toolbar.


Step 2: Create a Blank Query

  • Click on “New Source” and select “Blank Query.”

  • In the Queries pane, right-click on the new query and select “Advanced Editor.”

Step 3: Add Code to Advanced Editor

Paste the following code into the Advanced Editor:

let
    Source = DateTimeZone.LocalNow(),
    #"Converted to Table" = #table(1, {{Source}}),
    #"Changed Type" = Table.TransformColumnTypes(#"Converted to Table",{{"Column1", type datetimezone}}),
    #"Renamed Columns" = Table.RenameColumns(#"Changed Type",{{"Column1", "NOW"}})
in
    #"Renamed Columns"

Step 4: Apply and Close

  • Click “Done” to apply the changes.

  • Rename the table to something meaningful, such as “RefreshTime.”

  • Click on “Close & Apply” to load the changes.

Step 5: Create a New Measure

Now, you need to create a new measure using the table you just created:

Now Measure = "Last Refreshed at " & MIN('RefreshTime'[NOW])


Step 6: Add the Measure to a KPI Card

  • Insert a KPI Card visual onto your report canvas.

  • Drag the newly created measure to the Values field of the KPI Card.

And you’re done! Your Power BI dashboard now includes a card displaying the last refresh time.


For a specific timezone, use this:


let
    CurrentUTC = DateTimeZone.FixedUtcNow(),
    LocalTime = DateTimeZone.SwitchZone(CurrentUTC, 5.5),
    #"Converted to Table" = #table(1, {{LocalTime}}),
    #"Changed Type" = Table.TransformColumnTypes(#"Converted to Table",{{"Column1", type datetimezone}}),
    #"Renamed Columns" = Table.RenameColumns(#"Changed Type",{{"Column1", "NOW"}})
in
    #"Renamed Columns"

Here I am in India, so I have put "5.5" in the thirdline.

This is because India is 5 hours and 30 minutes ahead of UTC.


Similarly, you can change that number as per your time zone.

Eg- If you are in California, you can put "-8" as California is 8 hours behind UTC.


Then you can create a measure

Now Measure = 
"Data latest as of " & FORMAT(MIN('Now'[NOW]), "DD-MMM-YYYY hh:mm AM/PM") & " IST"

Here you can change IST to PST or what you desire.


This screenshot below is what my users in India see on the bottom-right section of my dashboard. Nice Right!


Conclusion

Adding a last refresh time card to your Power BI dashboard enhances transparency and helps users understand the currency of the data they are viewing. Follow these simple steps to improve the functionality of your Power BI reports.



Keywords:


  • Date time card in Power BI

  • Power BI dashboard tips

  • Power BI tutorial

  • Display last refresh time in Power BI

  • Display last refresh time in specific timezone







93 views0 comments

Recent Posts

See All

Mandatory Learnings for Power BI Beginners

Create connection with share point/Google sheet/folders. Know how to change the connection between GS to local excel, without getting...

Commentaires


bottom of page