Forum Discussion
Power BI - Refresh Data
- 2 years ago
Here's what I am thinking.
In the query editor, create a query that updates every time a semantic model refreshes. This query contains the refresh datetime.=DateTimeZone.SwitchZone( DateTimeZone.LocalNow(), 😎 // the service uses UTC this needs to converted to your local timezone. 8 = UTC+8. This query will always be a single row.In Power Automate, run a query against a dataset. The query should pickup the refresh datetime from the semantic model + the count of the client. You can simulate a query by creating a CALCULATED table inside Power BI and then transfer the logic to Power Automate. The syntax is similar to that of when using DAX Query or DAX Studio. Here's a sample:
DEFINE VAR __MAX = MAX ( MaxDateFile[Date] ) VAR __MAXFILE_DU = CALCULATE ( MAX ( MaxDateFile[Filename] ), FILTER ( MaxDateFile, MaxDateFile[Date] = __MAX && MaxDateFile[Type] = "DU" ) ) VAR __MAXFILE_PB = CALCULATE ( MAX ( MaxDateFile[Filename] ), FILTER ( MaxDateFile, MaxDateFile[Date] = __MAX && MaxDateFile[Type] = "PB" ) ) VAR __RESULT = ROW ( "Max Date", __MAX, "Max File DU", __MAXFILE_DU, "Max File PB", __MAXFILE_PB ) EVALUATE UNION ( ROW ( "Category", "Max Date:", "Value", FORMAT ( __MAX, "DD MMM YYYY" ) ), ROW ( "Category", "DU File:", "Value", __MAXFILE_DU ), ROW ( "Category", "PB File:", "Value", __MAXFILE_PB ) )Use DEFINE when defining variables. Use EVALUATE instead of RETURN.
Append the output to an Excel online table. Connect to the Excel file in Power BI. Load it to the model. Compare the latest count in the Excel file to that of current data.
The gist here is that you must be able to store a snapshot of your data somewhere to be able to make a comparison between the previous state of the data and the current.
Disclaimer: I am no Power Automate expert but I checked on the connectors and it seems my proposition is possible.
I was just thinking something like this, but you make it clear, thank you!!
This pbix might help once you get the tables set up. The logic inside compares the current against the previous state. In the screenshot below, the current refresh count is 104 which is the same as the previous refresh. The logic will pickup not the latest but the earliest datetime with the same count just after the count has changed to 104.