Step 4: Next Steps
How to Add / Remove Metrics or Dimensions
The codes provided are very basic and give you the ability to create your own table with our Yext Analytics metrics in the Power Query Editor. You can combine metrics from multiple sets if you want to have data from across your multiple solutions in one flow. Keep in mind that every metric cannot be paired with every dimension.
Add Metrics or Dimensions
To add metrics and dimensions, just add any names included in the body
array, for example [metrics = {"ANSWERS_CLICKS", "ANSWERS_SEARCHES"}, dimensions = {"DAYS"}]
.
Remove Metrics or Dimensions
To delete any unwanted metrics or dimensions, simply remove them from the line beginning with “body”. Remember to remove the entire name and quotes around it, like this “ANSWERS_SEARCHES”,
.
How to Add Filters
To add filters in your request you should append the end of the body
array. For example, if you wanted to filter the date range you should add filters = [startDate = #date(2015,01,01)]
after your dimensions. A full example is below:
[metrics = {"ANSWERS_CLICKS", "ANSWERS_SEARCHES"}, dimensions = {"DAYS"}, filters = [startDate = #date(2015,01,01)]]
If you want to configure dynamic date ranges such as Last 7 Days, Last 30 Days, or Last 90 Days you should include this code snippet for dates with your additional filters. This allows you to specify how many days of data from today to include. For example, for the Last 7 Days the startDate
is today minus 8 days and the endDate
is today minus 1 day. Remember that your endDate
should be closer to today than your startDate
!
startDate = #date(Date.Year(Date.AddDays(DateTime.LocalNow(),-8)),Date.Month(Date.AddDays(DateTime.LocalNow(),-8)), Date.Day(Date.AddDays(DateTime.LocalNow(),-8))), endDate = #date(Date.Year(Date.AddDays(DateTime.LocalNow(),-1)),Date.Month(Date.AddDays(DateTime.LocalNow(),-1)), Date.Day(Date.AddDays(DateTime.LocalNow(),-1)))
For a full list of metrics, dimensions, and filters options read the Yext Analytics API Documentation .
Data Refresh
When you need to refresh your data this is a manual process, you should follow these steps each time you want to refresh. You can also configure Incremental Refresh within Power BI Desktop, if you have this set up for other data sources, use your same settings!
Refresh your Data Manually
- Open your .pbix file and find the name of the query in the left Fields sidebar.
- Hover over to the right of your query name and three dots will appear.
- Click and select Refresh data.
For more information, review this Microsoft guide Refresh data screen .