Last refreshed date

The CurrentDate table, as described in the Data Source Parameters
section of Chapter 2Connecting to Sources and Transforming Data with M, contains only one column and one row, representing the date at the time the source M Query was executed. With this date value computed with each dataset refresh and loaded into the Data Model, a DAX Measure can be written to expose the date to the Power BI report visuals. In the following screenshot from the Report View, a measure named Last Refresh Msg uses a DAX variable to reference the parameter table and then passes this variable to a text string: 

Last refreshed message via the parameter table

It's common to include a last refreshed text message on at least one report page of every published report. In the event the source dataset has failed to refresh for several days or longer, the text message will advise users of the issue. See Chapter 4Developing DAX Measures and Security Roles for more information on DAX variables. 

For DirectQuery datasets, the M Query for the CurrentDate parameter table uses standard SQL syntax within the Value.NativeQuery() function, such as the following:

let Source = AdWorksSQLServer,
View = Value.NativeQuery(Source, "Select CAST(Current_Timestamp as date) as [CurrentDate]")
in View

The Source variable references the AdWorksSQLServer staging query, as described in the previous chapter. The Data Source Parameters section of Chapter 2Connecting to Sources and Transforming Data with M, contains the M Query for the CurrentDate parameter table in the import mode datasets. 

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.139.82.4