Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
4 years ago
Solved

Custom x-axis within filter context

Hey together,   is there any way within DAX or Power BI to customize the x-axis in a column chart?   I have a column chart with categorical values on the x-axis like "A", "B", "C", "D" and DISTIN...
  • v-yanjiang-msft's avatar
    4 years ago

    Hi Anonymous ,

    According to your description, I create a sample.

    Here's my solution. 

    1.Create a new table, don't make relationship between the two tables.

    Category Table = VALUES('Table'[Category])

    2.Create a measure.

    Sales Measure =
    IF (
        MAX ( 'Category Table'[Category] ) IN VALUES ( 'Table'[Category] ),
        MAXX (
            FILTER (
                ALL ( 'Table' ),
                'Table'[Category] = MAX ( 'Category Table'[Category] )
            ),
            'Table'[Sales]
        ),
        0
    )
    

     Put the category column from the new table in the Axis and the measure in the Values, get the result.

    Here, if you want the category D display other values instead of 0, you can directly modify the 0 part in the measure.

    I attach my sample below for reference.

     

    Best Regards,
    Community Support Team _ kalyj

    If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

    Custom x-axis within filter context.pbix19 KB