Forum Discussion

sparker95's avatar
sparker95
Frequent Visitor
1 year ago
Solved

Dynamic x-axis adjusted by slicer

I am not sure how to upload my model so please see my images.      I have a dynamic x-axis which needs to adjust according to the slicer on the page 'Model Name'. I am able to use ...
  • DataNinja777's avatar
    1 year ago

    Hi sparker95 ,

     

    To create a dynamic x-axis that adjusts according to your slicer selection and supports multiple series, you need to use a disconnected table for the x-axis values and link it via dynamic DAX measures. First, generate a disconnected table for your x-axis range dynamically, for instance:

    DynamicXAxis = GENERATESERIES(MIN('YourTable'[XValue]), MAX('YourTable'[XValue]), 1)
    

    Next, for each series measure (e.g., predictions, benchmark values), create dynamic measures using the disconnected axis. For example:

    BenchmarkValue = 
    CALCULATE(
        SUM('YourTable'[BenchmarkValue]),
        FILTER('YourTable', 'YourTable'[XValue] = SELECTEDVALUE(DynamicXAxis[Value]))
    )
    

    Apply this pattern for each series you wish to visualize, replacing the relevant measure columns accordingly. Now, place the disconnected table (DynamicXAxis[Value]) onto your visual's x-axis, and your dynamic measures on the y-axis. This approach maintains responsiveness to your slicer selections, enables multiple series display, and resolves the limitation you're facing.

     

    Best regards,