How to Create a Power BI Donut Chart with Conditional Categories
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.

- 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.
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.
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.
Open Power BI Desktop and navigate to the Data view or Report view from the left sidebar.
Select your target table (e.g., 'List of Capabilities') in the Fields pane, right-click, and choose 'New column'.
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.
Switch to the Report view, click the Donut Chart icon in the Visualizations pane, and add it to your canvas.
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.

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. Open your dataset in WPS Spreadsheet: Launch WPS Office and open your spreadsheet containing the IOC and ZTA FOC data.
- 2. Add a formula column: Use the =IFS() function to categorize your rows (e.g., checking for 'YES' values) directly in the grid.
- 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.

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.




