Did you know that you can add a refresh date to indicate when your data has been last refreshed ?
Below are the steps to do this.
For example if the below code is in the Advanced Editor, the "Removed Columns" in the step need to replace the "Renamed Columns" as shown below
let
Source = Sql.Databases("localhost"),
table1 = Source{[Name="table1"]}[Data],
dbo_table = table1 {[Schema="dbo",Item="table"]}[Data],
#"Removed Columns" = Table.RemoveColumns(dbo_table,{"col2", "col4", "col6"}),
#"Added Refresh Date" = Table.AddColumn(#"Removed Columns", "Refresh Date", each DateTimeZone.FixedUtcNow(), type datetimezone)
in
#"Added Refresh Date"
Footer = CONCATENATE("Last Refreshed " , MAX(Schedule[Refresh Date]))
Use a card visual to display the measure as shown below
There you go, you have the last refreshed date in your report
Below are the steps to do this.
- Open the report in Power BI Desktop
- Go to Edit Queries from the Home ribbon as shown below
- From the Power Query editor, choose the table where you would like to add the refresh date and click on Advance Editor as shown below
- Add the below code before the in statement
- Replace "Renamed Columns" from the above code to the name that is mentioned just above the line as shown below
For example if the below code is in the Advanced Editor, the "Removed Columns" in the step need to replace the "Renamed Columns" as shown below
let
Source = Sql.Databases("localhost"),
table1 = Source{[Name="table1"]}[Data],
dbo_table = table1 {[Schema="dbo",Item="table"]}[Data],
#"Removed Columns" = Table.RemoveColumns(dbo_table,{"col2", "col4", "col6"}),
#"Added Refresh Date" = Table.AddColumn(#"Removed Columns", "Refresh Date", each DateTimeZone.FixedUtcNow(), type datetimezone)
in
#"Added Refresh Date"
- This will create a new column named Refresh Date in the table.
- Close and Apply changes.
- Now create a new measure, in order to add the last refresh date to the report
- An example code for the new measure could be as below
Footer = CONCATENATE("Last Refreshed " , MAX(Schedule[Refresh Date]))
Use a card visual to display the measure as shown below
There you go, you have the last refreshed date in your report
1 comment:
I feel Power BI is the most useful and powerful tool which helps break out every problem categorically and separately folding itself to find solutions.
Powerbi Read Rest
Post a Comment