Forum Discussion

mjohannesson's avatar
mjohannesson
Icon for Advocate I rankAdvocate I
6 years ago

Dynamic index on X axis

I have a table similar to this:

SalesDateProductSalesAmount
2020-01-01A100
2020-01-06B50
2020-01-10A200

 

I have a measure with the cumulative sales amount and I would like to create a line chart with the measure as the value and having a dynamic index on the X axis. I.e. if there are no filters there should be 100, 150 and 350 in the chart and 1, 2, 3 on the X axis, and if the chart is filtered on product A, there should be 100 and 300 in the chart and 1, 2 on the X axis. How can I accomplish this?

3 Replies

  • jthomson's avatar
    jthomson
    Icon for Solution Sage rankSolution Sage

    How is your measure worded? This should just work with a standard slicer/filter on your product

    • mjohannesson's avatar
      mjohannesson
      Icon for Advocate I rankAdvocate I

       

      CumulativeSalesAmount = CALCULATE(SUM(F_Sales[SalesAmount]), FILTER(ALL(F_Sales), F_Sales[WkSalesDate] <= MAX(F_Sales[WkSalesDate])))

       

       

      This works fine if I put the sales date (from the related Date dimension) on the X axis, but I would like to have a sequential index on the X axis instead.

  • v-eachen-msft's avatar
    v-eachen-msft
    Icon for Community Support rankCommunity Support

    Hi mjohannesson ,

     

    X-axis is based on column which is static, you could show/hide some of x-axis. But Power BI doesn't support dynamic x-axis value.