Visualizations for Model-Driven Apps
Complete the full lesson to earn 25 points
Work through each section, then tap “Mark as Complete” on the last one.
✦ Skip the page breaks and see fewer ads — read each lesson on a single page with Pro
Visualizations for Model-Driven Apps: Designing Data-Driven User Experiences
Introduction: Why Visualization Matters in Dataverse
When we build model-driven apps on the Dataverse platform, we are essentially creating structured interfaces for interacting with complex relational data. While forms and views are excellent for transactional operations—like editing a single record or scanning a list of items—they often fail to provide the "big picture." Users rarely need to see a raw table of five thousand rows; they need to understand what that data means for their daily operations. This is where visualizations come into play.
Visualizations in model-driven apps transform static data into actionable intelligence. By integrating charts, dashboards, and embedded reports directly into the application, you provide users with the ability to identify trends, spot outliers, and make informed decisions without ever leaving their workspace. In this lesson, we will explore the mechanics of building, configuring, and deploying effective visualizations that drive user adoption and business value.
Understanding the Visualization Hierarchy
In the Dataverse ecosystem, visualizations are categorized into three primary layers: Charts, Dashboards, and Embedded Reports. Each serves a distinct purpose and requires a different level of effort to implement.
1. Charts
Charts are the fundamental building blocks of visualization. They are tied directly to a specific table (entity) and provide a graphical representation of the data within that table. When a user navigates to a view, they can click the "Show Chart" button to display a pane that summarizes the data currently in that view.
2. Dashboards
Dashboards act as the container for your visualizations. They allow you to combine multiple charts, views, and web resources into a single screen. There are two types of dashboards:
- System Dashboards: Created by administrators and available to all users.
- Personal Dashboards: Created by individual users to meet their specific reporting needs.
3. Embedded Reports (Power BI)
While native charts are great for quick summaries, Power BI integration allows for deeper, cross-table analysis. By embedding Power BI reports directly into the app, you can provide advanced filtering, interactive drilling, and complex calculations that go beyond the capabilities of the native charting engine.
Callout: Native Charts vs. Power BI Native charts are best for quick, transactional data analysis that must remain performant and context-aware. Power BI is the superior choice for complex, multi-source, or historical reporting that requires advanced data modeling (DAX) and aesthetic customization.
Configuring Native Charts: A Step-by-Step Guide
Configuring a chart in a model-driven app is a declarative process. You do not need to write code to create a basic bar or pie chart; rather, you define the data series and the category axis within the chart designer.
Step 1: Accessing the Chart Designer
To begin, navigate to the Power Apps maker portal. Select your solution, find the table you wish to visualize, and click on the "Charts" tab. Here, you can create a new chart.
Step 2: Defining the Data Series
The series represents the numerical data you want to display. For instance, if you are analyzing "Sales Opportunities," your series might be "Estimated Revenue" with an aggregation function such as "Sum." You can add multiple series to a single chart, provided the data types are compatible.
Step 3: Defining the Category Axis
The category axis defines how the data is grouped. Using the previous example, you might group the revenue by "Owner" or "Close Date." This allows the chart to show, for example, the sum of revenue per salesperson.
Step 4: Formatting and Refining
After selecting your fields, you can choose the chart type. Common types include:
- Column/Bar Charts: Best for comparing quantities across categories.
- Pie/Donut Charts: Useful for showing parts of a whole (keep segments under 6 for readability).
- Line Charts: Essential for visualizing trends over time.
- Funnel Charts: Ideal for tracking stages in a process, like a sales pipeline.
Tip: Keep it Simple A common mistake is cramming too much data into a single chart. If a chart has more than 10-12 data points, it becomes difficult to read. If you find yourself needing more complexity, consider creating multiple targeted charts instead.
Advanced Customization: XML Configuration
While the standard designer covers 90% of use cases, there are times when you need more control over the underlying structure of the chart. Dataverse charts are defined by a specific XML schema. You can export these charts, modify the XML, and re-import them to achieve functionality that the standard UI does not support, such as custom color palettes or advanced formatting.
Understanding the XML Structure
The XML definition consists of two main parts: the datadefinition and the presentationdefinition.
<datadefinition>
<fetchcollection>
<fetch mapping='logical' aggregate='true'>
<entity name='opportunity'>
<attribute name='estimatedvalue' alias='total_revenue' aggregate='sum' />
<attribute name='ownerid' alias='owner' groupby='true' />
</entity>
</fetch>
</fetchcollection>
<categorycollection>
<category alias='owner'>
<measurecollection>
<measure alias='total_revenue' />
</measurecollection>
</category>
</categorycollection>
</datadefinition>
In this snippet, we are defining a fetch expression that aggregates the estimatedvalue field of the opportunity table, grouped by the ownerid. The presentationdefinition then dictates how this data appears in the UI, such as the chart type and labels.
Warning: XML Modification Editing XML directly is powerful but risky. Always keep a backup of the original XML file before making changes. If the schema is malformed, the chart will fail to render, and the error messages can be difficult to interpret.
Designing Effective Dashboards
A dashboard is not merely a collection of charts; it is a communication tool. A well-designed dashboard tells a story about the health of the business process.
The Layout Strategy
When designing a dashboard, follow the "F-Pattern" of reading. Users typically scan from top-left to bottom-right. Place your most important Key Performance Indicators (KPIs) in the top-left corner. Use smaller, supporting charts in the lower sections to provide context.
Interactive Filtering
One of the most powerful features of model-driven dashboards is the ability to filter the entire dashboard based on a selection in one chart. If a user clicks on a specific segment in a pie chart, all other charts and lists on the dashboard automatically filter to show data related to that segment. This allows for rapid "drill-down" analysis.
Best Practices for Layouts
- Use White Space: Do not pack too many components into one view. Leave space between charts so the eye can separate the information.
- Consistent Themes: Use consistent colors for categories across all charts. If "Closed Won" is green in one chart, it should be green in all of them.
- Contextual Lists: Always include a list view on your dashboard that corresponds to the data being visualized. This allows the user to click on a chart element and immediately see the underlying records in a list.
Embedding Power BI Reports
When native charts reach their limit—perhaps because you need to join data from multiple tables that aren't directly related, or because you need complex DAX calculations—it is time to bring in Power BI.
Implementation Steps
- Develop the Report: Create your report in Power BI Desktop using the Dataverse connector.
- Publish to Power BI Service: Upload your report to a workspace.
- Enable in Environment: Navigate to the Power Platform Admin Center and ensure Power BI integration is enabled for your environment.
- Embed in the App: In the model-driven app designer, add a new dashboard and select "Power BI Report" as a component. Select your workspace and report from the list.
Handling Security
Security in Power BI follows different rules than Dataverse. While Dataverse uses Role-Based Access Control (RBAC) to limit row-level access, Power BI requires you to configure Row-Level Security (RLS) within the report itself if you want to ensure users only see the data they are permitted to view. Failure to configure RLS may result in users seeing data they should not have access to, even if they cannot see that data in the model-driven app itself.
Common Pitfalls and Troubleshooting
Even experienced developers fall into traps when building visualizations. Being aware of these pitfalls can save you hours of debugging.
1. Performance Issues
If your charts are slow to load, the issue is usually the underlying view or the complexity of the query. Avoid using "Fetch" queries that scan millions of records without proper filtering. Always ensure that the fields used for grouping and aggregation are indexed in the Dataverse database.
2. Misleading Visualizations
Choosing the wrong chart type is a common error. For example, using a line chart for data that is not time-based is confusing. Similarly, using a pie chart for categories with very similar values makes it impossible for the user to determine which is larger. Always ask: "What question is this chart answering?"
3. Ignoring Mobile Users
Model-driven apps are responsive, but charts often do not scale well on small screens. When designing dashboards, test them on a mobile device or use the mobile emulator in the designer. You may need to create a separate "Mobile Dashboard" with fewer, more focused charts.
4. Hard-Coding Labels
Avoid hard-coding labels in your chart XML if your app supports multiple languages. Always use resource strings so that your labels translate automatically based on the user's browser language settings.
Comparison Table: Visualization Options
| Feature | Native Charts | Dashboards | Power BI Embedded |
|---|---|---|---|
| Complexity | Low | Low-Medium | High |
| Data Sources | Single Table | Multiple (Views/Charts) | Multiple (External/Internal) |
| Interactivity | Basic (Drill-down) | High (Cross-filtering) | Very High (Custom) |
| Performance | High | High | Depends on Data Model |
| Setup Time | Minutes | Minutes | Hours/Days |
Practical Example: Visualizing a Sales Pipeline
Let’s walk through a scenario: You need to provide sales managers with a view of their team's performance.
- The Goal: Show "Estimated Revenue" by "Sales Stage" for the current quarter.
- The View: Create a system view that filters opportunities to only include those with a "Close Date" in the current quarter.
- The Chart: Create a funnel chart. Use "Sales Stage" as the category and "Sum of Estimated Revenue" as the series.
- The Dashboard: Create a new dashboard. Place the funnel chart on the left. On the right, place a list view of the "Open Opportunities."
- The Result: When the manager clicks on the "Negotiation" slice of the funnel, the list view on the right automatically updates to show only the opportunities in the negotiation phase.
This simple setup provides an immediate, interactive experience that helps the manager prioritize their day without needing an external report.
Best Practices for Long-Term Maintenance
Visualizations are not "set and forget." As your data grows and business needs evolve, your charts will need to change.
- Version Control: Store your chart XML files in a source control system like GitHub or Azure DevOps. This allows you to track changes and roll back if a new configuration causes issues.
- User Feedback Loops: Every six months, review your dashboards with the end-users. Ask them which charts they never look at and remove them. Clutter is the enemy of clarity.
- Documentation: Maintain a simple document that explains the purpose of each chart and the logic behind any complex aggregations. This is invaluable when a new administrator takes over the system.
- Naming Conventions: Use clear, descriptive names for your charts. Instead of "Chart 1," use "Revenue by Stage - Current Quarter." This makes it easier for users to find the right visualization in the selection menu.
Callout: The "So What?" Test Before publishing any visualization, ask yourself the "So What?" test. If a user looks at the chart and cannot immediately identify a decision they need to make, the chart is likely unnecessary. Every pixel on a dashboard should earn its place by providing actionable insight.
Integrating JavaScript for Advanced Interactivity
While the standard designer is sufficient for most, you can use the Client API to interact with charts programmatically. For example, you can use JavaScript to refresh a chart when a form field changes, or to programmatically set a specific filter on a dashboard.
// Example: Refreshing a chart on a form
function refreshChart(executionContext) {
var formContext = executionContext.getFormContext();
var chartControl = formContext.getControl("chart_name");
if (chartControl) {
chartControl.refresh();
}
}
This code snippet demonstrates how to force a refresh on a chart control. This is particularly useful in scenarios where a user updates a record and you want the dashboard to reflect the change immediately without requiring a full page reload.
Addressing Common Questions (FAQ)
Q: Can I share a personal dashboard with my team? A: Yes, you can share a personal dashboard with specific users or teams. However, if you want a dashboard to be available to everyone by default, you should create it as a System Dashboard.
Q: Why don't my charts show up on the mobile app? A: Ensure that the dashboard is enabled for the "Mobile" client in the dashboard properties. Some complex charts or web resources may not be supported on the mobile interface.
Q: How many charts can I put on one dashboard? A: While the platform allows for multiple, the practical limit is usually 6-8. Any more than that will lead to performance degradation and a poor user experience.
Q: Can I use custom colors in native charts?
A: Yes, you can define colors in the presentationdefinition XML. You can specify hexadecimal color codes for each series to match your company's branding.
Key Takeaways
- Purpose-Driven Design: Start with the business question. Only build visualizations that lead to a clear, actionable decision.
- Hierarchy of Tools: Use native charts for quick, internal table analysis. Reserve Power BI for complex, multi-source, or historical reporting.
- Interactivity is Key: Leverage the built-in filtering capabilities of dashboards to allow users to drill down into the data naturally.
- Simplicity Wins: Avoid clutter. Use clean layouts, consistent color schemes, and limit the number of data points to ensure readability.
- Security First: When using Power BI, never ignore Row-Level Security. Always ensure that the data visible in the report aligns with the user's security role in Dataverse.
- Maintainability: Treat your charts as code. Use descriptive names, store XML definitions in source control, and periodically review dashboards with users to remove redundant information.
- Performance Matters: Avoid complex, unindexed queries. Ensure your dashboards are optimized for the speed at which users expect to work.
By following these principles, you will move beyond simply "displaying data" to creating a powerful analytical toolset that empowers your users to do their best work. Remember that the best visualizations are those that the users don't even realize are "tools"—they are simply the natural, intuitive way they interact with their data every day.
Continue the course
Enjoying the courses?
Everything stays free. Pro shows fewer ads, doubles your daily points limit so you progress twice as fast, and lets you read each lesson on one page.
- ✓ Fewer advertisements
- ✓ 2× daily points limit
- ✓ Distraction-free lessons