PBI - 展示Last Refresh Date
ref:Display Last Refreshed Date in Power BI - The Excelguru BlogThe Excelguru Blog
Display the Last Refreshed Date in Power BI
Generate Last Refreshed Date with Power Query
Unlike the previous article, to work with Power BI, we need to generate the Last Refresh date ourselves using Power Query. No big deal, it is as simple as this:
- Open PowerBI Desktop
- Get Data –-> Blank Query
- Go to Home –> Advanced Editor and replace the code in the window with this:
let
Source = #table(type table[LastRefresh=datetime], {{DateTime.LocalNow()}})
in
Source
- Click Done and rename the query “LastRefresh_Local”
- Click Close & Apply
This code makes a nice little table that returns the current date and time each time we refresh the solution.
Create the Last Refreshed Measure
To finish it off, we need to create a simple measure and add it to our dashboard.
- Go to your Report window –> New Measure –> Define it as follows:
Last Refreshed (Local) = FORMAT(LASTDATE(LastRefresh_Local[LastRefresh]),"mmm dd, yyyy hh:mm:ss AM/PM")
- Now let’s create a Card visual to hold it:
So far everything looks really good here. The card is formatted nicely, and I updates to the current date and time every time I hit the refresh button. It’s a thing of beauty! What could possibly go wrong with this?
Publishing to the Power BI Service
Encouraged with our visual, we’ll now publish it to Power BI:
- File –> Publish –> Publish to Power BI
- Login to the Power BI service and scroll down to the Datasets area
At this point you should click the little … to the right of the dataset you uploaded (whatever you called it) and click Refresh. It will prepare for a bit, then should refresh. If your experience is anything like mine, your report shows this:
【推荐】国内首个AI IDE,深度理解中文开发场景,立即下载体验Trae
【推荐】编程新体验,更懂你的AI,立即体验豆包MarsCode编程助手
【推荐】抖音旗下AI助手豆包,你的智能百科全书,全免费不限次数
【推荐】轻量又高性能的 SSH 工具 IShell:AI 加持,快人一步
· DeepSeek 开源周回顾「GitHub 热点速览」
· 物流快递公司核心技术能力-地址解析分单基础技术分享
· .NET 10首个预览版发布:重大改进与新特性概览!
· AI与.NET技术实操系列(二):开始使用ML.NET
· .NET10 - 预览版1新功能体验(一)