To add a refresh date in Power BI, you can follow the steps below:
- Open your Power BI Desktop application.
- Go to the “Home” tab in the ribbon.
- Click on the “Edit Queries” button.
- In the “Queries” pane on the right-hand side, select the desired query.
- Click on the “Transform Data” button.
- In the Power Query Editor window, go to the “Add Column” tab in the ribbon and click on the “Date” option.
- Select the “Date” option and specify the format you want for the date column.
- Click “OK” to add the new date column.
- Close the Power Query Editor window and apply the changes to the dataset.
Once you have added the refresh date column, you can display it on your Power BI report by following these steps:
- Switch to the “Report” view in Power BI Desktop.
- Go to the “Home” tab and click on the “Text Box” button in the “Insert” section.
- Draw a text box on your report canvas.
- In the “Visualizations” pane on the right-hand side, select the newly created text box.
- In the “Fields” pane, select the dataset and the refresh date column.
- Drag and drop the refresh date column onto the text box.
- Resize and reposition the text box as needed.
Now, the report will display the refresh date based on the data you have specified in the Power Query Editor. Make sure to refresh the dataset regularly to see the updated refresh date.
Example:
let
Source = Excel.Workbook(File.Contents("C:\Data\SampleData.xlsx"), null, true),
Sheet1_Sheet = Source{[Item="Sheet1",Kind="Sheet"]}[Data],
#"Promoted Headers" = Table.PromoteHeaders(Sheet1_Sheet, [PromoteAllScalars=true]),
#"Added Custom" = Table.AddColumn(#"Promoted Headers", "Refresh Date", each DateTime.LocalNow(), type datetime)
in
#"Added Custom"