Forum Discussion

swalke's avatar
swalke
Frequent Visitor
1 year ago
Solved

Dynamic Axis on Bar chart

Hello,  I have a table visuals with customer data. I have data like current quarter sales, previous quarter sales, Prior to previous quarter sales. I created all this using measure. Other measures i...
  • rohit1991's avatar
    1 year ago

    Hi swalke  ,


    Its because your “Increasing/Decreasing” (or other assignment groups) are calculated by a DAX measure that depends on sales and the current quarter, the actual categories can change (appear/disappear) every time your date slicer moves. That makes your chart axis dynamic and hard to keep stable, which is frustrating for both devs and users.

    The best practice is to create a separate table in Power BI that lists all possible assignment categories you want to show on your chart, like “Increasing”, “Decreasing”, “Base”, “Medium”, “High”, etc. This is sometimes called a “scaffold” table or static axis.

    Steps:

    1. Create a Categories Table:
      Go to “Home” → “Enter Data” and add a single column with every category you need.

       

    2. In your bar/column chart, use this new table as your X (or Y) axis, not the assignment calculated by your measure.

    3. Write your DAX measure to count customers (or whatever you need) for each category, using your logic for “Increasing”, “Decreasing”, etc.

    4. Put your AssignmentCategory field from the static table on the axis, and your measure as the value. Now, all categories will always show, even if there are zero customers in a group for the current slicer selection.