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
Source = DateTimeZone.FixedUtcNow(),
#"Converted to Table" = #table(1, {{Source}}),
#"Changed Type" = Table.TransformColumnTypes(#"Converted to Table",{{"Column1", type datetimezone}}),
#"Renamed Columns" = Table.RenameColumns(#"Changed Type",{{"Column1", "NOW"}}),
#"Added Custom" = Table.AddColumn(#"Renamed Columns", "N", each DateTimeZone.SwitchZone([NOW], +8)),
#"Removed Columns" = Table.RemoveColumns(#"Added Custom",{"NOW"}),
#"Changed Type1" = Table.TransformColumnTypes(#"Removed Columns",{{"N", type datetimezone}}),
#"Renamed Columns1" = Table.RenameColumns(#"Changed Type1",{{"N", "NOW"}})
in
#"Renamed Columns1"
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
Comments