Use DAX Measures in a Power BI Clustered Bar Chart
Question details
The user needs to display invoice and credit condition counts in a Power BI clustered bar chart using DAX calculations.

- Product
- Microsoft Power BI
- Device & OS
- not provided
- Scenario
- The user wants to use DAX measures to provide both the category labels and the values in a clustered bar chart.
- Observed behavior
- DAX measures can return numeric results for chart values, but they generally cannot act as dynamic category fields on the chart axis.
Confirm that you have separate measures for each condition, such as Invoice Count and Credit Count. Also identify whether the chart must respond to slicers, because calculated tables update on data refresh rather than every visual interaction.
Create a disconnected category table and a SWITCH measure
Use this approach when you need Invoice and Credit labels on the chart axis while keeping the counts responsive to report filters and slicers.
A clustered bar chart requires a column for its category axis. Create a small table containing the labels, then use one measure to return the matching existing DAX measure for each label.
In Power BI Desktop, select Modeling > New table and create a table such as: Chart Conditions = DATATABLE("Condition", STRING, {{"Invoice"}, {"Credit"}}).
Select Modeling > New measure and create a measure such as: Selected Condition Count = SWITCH(SELECTEDVALUE('Chart Conditions'[Condition]), "Invoice", [Invoice Count], "Credit", [Credit Count], BLANK()).
Insert a Clustered bar chart, drag Chart Conditions[Condition] to the Y-axis or category axis, and drag [Selected Condition Count] to the X-axis or values well.
Select a slicer or add a visual-level filter and confirm that [Invoice Count] and [Credit Count] update through the Selected Condition Count measure.

Create a calculated summary table for refresh-based counts
Use a calculated table when the chart can show counts calculated during dataset refresh and does not need to recalculate for every slicer selection.
Reshape the source data to use a condition column
Use this approach when invoice and credit are currently represented by separate logic or columns and you want a simpler, scalable chart model.
Create a Clustered Bar Chart from Summarized Data with WPS Spreadsheets
DAX measure behavior is specific to Power BI, but WPS Office provides a free, lightweight way to summarize exported report data and create clustered bar charts. Its familiar spreadsheet interface supports a smooth transition for users working with Microsoft Office files.
- 1. Open the exported workbook: Open the Power BI-exported XLSX file in WPS Spreadsheets from the WPS Office home screen.
- 2. Prepare category and count columns: Place condition labels such as Invoice and Credit in one column and their corresponding counts in the adjacent column.
- 3. Insert a clustered bar chart: Select the summary range, choose Insert > Chart, and select a Bar or Column chart with the clustered option.

Frequently Asked Questions
Why can’t I put a DAX measure on the category axis in Power BI?
A DAX measure returns a calculated scalar result in the current filter context, not a reusable column of category values. Use a table column, such as a Condition field, for the category axis.
Can I show multiple measures in a clustered bar chart?
Yes. Add a category column to the axis and add separate measures, such as [Invoice Count] and [Credit Count], to the Values field well. Power BI creates separate bars for each measure.
How do I make Invoice and Credit labels work with one DAX measure?
Create a small disconnected table in Modeling > New table with Invoice and Credit labels, then use SWITCH with SELECTEDVALUE to return the appropriate measure for each selected label.
Will a calculated table update when I select a slicer?
Calculated tables are generally evaluated during dataset refresh. For counts that must respond immediately to slicers and visual filters, use measures and a category table instead.
When should I reshape the data instead of creating separate measures?
Reshape the data when Invoice, Credit, and other conditions represent repeating category values. A single Condition column and one count measure are easier to expand and chart than many separate measures.




