How To Add Refresh Date In Power Bi Report

To add a refresh date in a Power BI report, you can follow these steps:

  1. Create a new measure in Power BI by clicking on the “Modeling” tab on the ribbon and then selecting “New Measure”.
  2. In the formula bar, enter the following DAX formula:
    
      Refresh Date = TODAY()
    
  

This formula will get the current date whenever the report is refreshed.

  1. Now, you need to add this measure to your report. You can do this by dragging and dropping the “Refresh Date” measure to a visual or adding it to the Values area of a table or matrix visual.
  2. Format the visual to display the date in the desired format.

For example, let’s say you have a visual that shows the refresh date:

    
      <div id="refreshDateVisual"></div>
    
  

In your JavaScript code, you can use the Power BI JavaScript API to update the content of the “refreshDateVisual” div with the refresh date:

    
      var visual = powerbi.getVisualByName("refreshDateVisual");
      visual.setProperty({
        "content": {
          "title": {
            "text": "Refresh Date"
          },
          "dataPoints": [
            {
              "value": "<a id='refreshDateValue' />"
            }
          ]
        }
      });
      
      var refreshDate = new Date();
      document.getElementById("refreshDateValue").innerText = refreshDate.toDateString();
    
  

This JavaScript code retrieves the visual by its name, sets the title and data point, and then updates the “refreshDateValue” element with the current date.

By using these steps and customizing the visuals and JavaScript code, you can add a refresh date to your Power BI report.

Read more interesting post

Leave a comment