We have a KPI dashboard embedded in our subscription management module that tracks renewal rates, churn metrics, and revenue forecasts. The batch job that calculates these metrics completes successfully every night, but the KPI dashboard is not updating automatically. We have to manually refresh the dashboard each morning to see the updated data.
Checking the batch job history shows successful completion with no errors:
The manual refresh requirement is becoming a bottleneck for our renewal reporting team. They need to see current metrics when they start their day, but the dashboard shows yesterday’s data until someone manually clicks refresh. What could be preventing the automatic update after the batch job completes?
Let me provide you with a complete solution for automating your KPI dashboard refresh after the batch job completes.
Root Cause Analysis
Your batch job successfully calculates and stores the subscription KPIs in D365 database tables. However, the Power BI dataset that feeds your embedded dashboard operates on a separate refresh schedule. Power BI doesn’t monitor the D365 database for changes - it only updates when explicitly told to refresh, either via scheduled refresh in Power BI service or through an API call.
Solution: Automated Batch Job Chain with Power BI Refresh
Step 1: Configure Batch Job Dependencies
Navigate to System administration > Inquiries > Batch jobs. Find your ‘Calculate Subscription KPIs’ batch job. You’ll create a dependent batch job:
Create new batch job: ‘Refresh Subscription Dashboard’
Set dependency: Configure this job to run only after ‘Calculate Subscription KPIs’ completes successfully
In the batch job configuration, under ‘Dependencies’ tab, add the calculation job as a prerequisite
Set condition: ‘Run only if prerequisite ended successfully’
Step 2: Power BI API Integration
You need to set up the Power BI API connection:
Register an application in Azure AD with Power BI API permissions
Note the Application ID, Tenant ID, and create a client secret
In D365, store these credentials securely (use Key Vault integration if available)
Grant the service principal access to your Power BI workspace containing the subscription dashboard
Step 3: Create Custom Batch Class (Required Code)
You’ll need a custom X++ class to call the Power BI REST API:
// Pseudocode - Key implementation steps:
1. Authenticate to Power BI using service principal credentials
2. Construct API endpoint: POST /datasets/{datasetId}/refreshes
3. Execute HTTP request with proper headers (Authorization: Bearer {token})
4. Log response and handle any errors
5. Return success/failure status to batch framework
// See documentation: Power BI REST API Reference
Step 4: Alternative - Power Automate Flow (No Code Option)
If custom code isn’t feasible, use Power Automate:
Create a flow triggered by ‘When a batch job completes’ (D365 connector)
Add condition: Job name equals ‘Calculate Subscription KPIs’ AND Status equals ‘Ended’
Add action: ‘Refresh a dataset’ (Power BI connector)
Select your subscription dashboard dataset
Configure flow to run under a service account
Step 5: Verification and Monitoring
After setup, monitor the batch job chain for 3-5 days
Check batch job history to confirm the refresh job runs after calculation job
Verify Power BI dataset refresh history shows successful refreshes at expected times
Confirm your renewal reporting team sees current data without manual refresh
Recommended Approach for Your Scenario
Given that your calculation job completes around 2:47 AM, I recommend:
Use the batch job dependency method (no manual intervention needed)
Implement the Power Automate flow option (easier than custom code, no deployment required)
Set the flow to trigger within 5 minutes of batch job completion
Power BI dataset refresh typically takes 2-5 minutes for subscription data
Dashboard will show current data by 3:00 AM, well before your team starts at 8:00 AM
Troubleshooting Tips
If Power BI refresh fails, check dataset refresh history in Power BI service for error details
Ensure service principal has ‘Contributor’ role on the Power BI workspace
Verify data source credentials in Power BI dataset settings are current
Monitor batch job execution times to ensure they don’t overlap with Power BI’s own scheduled refreshes
This solution eliminates the manual refresh requirement and ensures your renewal reporting team always sees current KPI data when they begin their workday.
This draft is based on general Microsoft Dynamics 365 knowledge. It has not been verified against your specific version and environment. Practitioners: verify the steps and share your experience below.
Is the KPI dashboard a Power BI embedded visual or a native D365 form? If it’s Power BI, the batch job completing doesn’t automatically trigger a Power BI dataset refresh. You need a separate process to refresh the Power BI dataset after your calculation batch job finishes.
It’s a Power BI embedded dashboard. So even though the underlying data in D365 is updated by the batch job, Power BI doesn’t know about it? I assumed the dataset would automatically pick up the new values from the database.
Correct, Power BI datasets don’t automatically detect changes in the source database. You need to explicitly trigger a dataset refresh. There are a few ways to do this: schedule the dataset refresh in Power BI service to run after your batch job window, use Power BI REST API to trigger refresh programmatically, or set up a flow in Power Automate. Which approach depends on your technical capabilities and infrastructure.
We had this exact issue with our financial dashboards. We solved it by chaining batch jobs. After the calculation batch job completes, we trigger a second batch job that calls the Power BI API to refresh the dataset. You need to set up the API credentials and configure the batch job dependency properly, but it works reliably once configured.
The chained batch job approach sounds like it would work well for us. How do you configure the batch job dependency to ensure the Power BI refresh only runs after the calculation job succeeds? And does it require custom code to call the Power BI API?