logo
search
Others

How to Create a Power BI Donut Chart with Conditional Categories

Guest WriterGuest Writer Sep 25, 2026 870 views

Question details

The user needs to categorize Power BI dataset rows into ZTA FOC, IOC, or Neither for a donut chart without triggering a single-value determination error.

How to Create a Power BI Donut Chart with Conditional Categories
Product
Power BI
Device & OS
not provided
Scenario
Creating a donut chart visualization based on multiple column conditions (Capability IOC and Capability ZTA FOC).
Observed behavior
Using measures for row-level logic causes a single-value determination error. A row-by-row categorization is required to populate the chart legend.
Before you start

Ensure you have access to edit the data model in Power BI Desktop and that your dataset contains the 'Capability IOC' and 'Capability ZTA FOC' columns.

Solution 1Recommended

Use a DAX Calculated Column with SWITCH Logic

Create a calculated column instead of a measure to evaluate each row individually, avoiding aggregation errors.

When you need to categorize individual rows based on multiple conditions, a calculated column is the appropriate choice. Unlike measures, which aggregate data on the fly, a calculated column evaluates your DAX logic row by row during data load, making it perfect for chart legends.

1
Open the Data Model

Open Power BI Desktop and navigate to the Data view or Report view from the left sidebar.

2
Create a New Column

Select your target table (e.g., 'List of Capabilities') in the Fields pane, right-click, and choose 'New column'.

3
Enter the DAX Formula

Enter the following formula: Category = SWITCH( TRUE(), 'List of Capabilities'[Capability ZTA FOC] = "YES", "ZTA FOC", 'List of Capabilities'[Capability IOC] = "YES", "IOC", "Neither" ) and press Enter.

4
Add the Donut Chart Visual

Switch to the Report view, click the Donut Chart icon in the Visualizations pane, and add it to your canvas.

5
Configure the Chart Fields

Drag the newly created 'Category' column into the Legend field of the donut chart. Finally, drag a capability identifier column (or any unique ID) into the Values field to count the categories.

Use a DAX Calculated Column with SWITCH Logic
Avoid Aggregation Errors: Using a calculated column guarantees row-level evaluation, successfully bypassing the single-value determination error common with improper measure usage.
Free Microsoft Office alternative

Analyze Data and Create Stunning Charts with WPS Spreadsheet

While Power BI is a powerful tool for complex DAX logic, everyday data visualization and categorization can be effortlessly handled in WPS Spreadsheet. It offers a lightweight, highly compatible alternative to Microsoft Excel for generating donut charts, using intuitive IF/IFS formulas without the steep learning curve of DAX.

  1. 1. Open your dataset in WPS Spreadsheet: Launch WPS Office and open your spreadsheet containing the IOC and ZTA FOC data.
  2. 2. Add a formula column: Use the =IFS() function to categorize your rows (e.g., checking for 'YES' values) directly in the grid.
  3. 3. Insert a Donut Chart: Highlight the categorized data, navigate to the Insert tab on the ribbon, and select the Donut Chart option to visualize your results.
Fully compatible with Microsoft Excel (.xlsx, .xls) and CSV formats.Create beautiful Donut, Pie, and Bar charts in seconds.Use built-in IFS and SWITCH formulas for straightforward conditional categorization.Free and lightweight alternative to heavy data modeling tools.Familiar user interface ensuring seamless migration from Microsoft Office.
microsoft office alternative - wps office

Frequently Asked Questions

Why do I get a single-value determination error in Power BI DAX?

This error occurs when a DAX expression expects a single scalar value but receives a table or multiple values. Using a calculated column instead of a measure for row-level categorization resolves this issue.

Can I use an IF statement instead of SWITCH in Power BI?

Yes, you can use nested IF statements in DAX. However, using SWITCH(TRUE(), ...) is much easier to read and maintain when you have multiple independent conditions, such as checking for both ZTA FOC and IOC statuses.

What is the difference between a measure and a calculated column in Power BI?

A calculated column evaluates data row by row during the data refresh, making it ideal for static categories or dimensions (like chart legends). A measure aggregates data on the fly based on user interactions and filters, making it suitable for calculations like totals and averages.

How do I properly count the categories in my Power BI donut chart?

Once your conditional category column is added to the chart's Legend, drag a unique identifier column (like a Row ID or Capability ID) into the Values field. Ensure the aggregation method for that field is set to 'Count' or 'Count (Distinct)' in the field drop-down.