Forum Discussion

maracles's avatar
maracles
Icon for Resolver II rankResolver II
10 years ago

Flexible line chart x-axis

What I am trying to do is provide a supervisor with one chart that compares Revenue YTD. Two lines should be plottedl 2015 and 2016.

I have the measures and I can plot this chart without issue. My challenge is making the x-axis behave as requested

By default the x axis should be listed based on days however they would like to have two sets of filters available to him; Months and Quarters

Therefore:

Years

When a year is selected the x-axis would show months but the lines would be plotted based on days. 

I can get this to work as a standalone chart. 

Quarters


When a quarter is selected the x-axis narrows to that selected 90 day period but the label on the x-axis shows Months (even though it is calcualted on days). 

I can get this to work fine as an individual chart. 

Correction. I cannot actually get this to work, it was working only when I used a single year and had date as the x-axis. Power BI automatically converted the dates to months to make the chart more readable however I cannot use a 'date' column as it create a continuous line rather than two lines on-top of each other. 

Months

If a month is selected it narrows to those 28-31 days selected. The x-axis woudl then show labels for individual dates. 

Again, I can build this chart as stand-alone chart. My question is whether it is possible to build a single flexible chart where the axis switches based on the filter so that it meets both requested behaviours. 


The alternative is obviously to have multiple charts but curious as to whether the above can be achieved. 






5 Replies

  • Greg_Deckler's avatar
    Greg_Deckler
    Icon for Community Champion rankCommunity Champion

    maracles - Can you drag your Year, Month and Day columns into a hierarchy in the X-Axis and use drilldown? Well, I guess that won't work on a line chart, you'd have to go with Column chart. OK, correction, you could possibly use the combined column/line chart and just not have a value for Column, only for Line.

    • maracles's avatar
      maracles
      Icon for Resolver II rankResolver II

      I was hoping for something like this which is how I would do it in Excel, howeve Power BI doesn't appear to allow that functionality. I can only add one dimension to the x-axis, I cannot layer them.

      If I allow PowerBI to implement its own heirachy which is what happens when you try to use the 'date' dimension it simply makes a continuous line.  

      Everything works if I use Day of Year, but this just isn't friendly enough to interpret apparently. I'm looking for an alternative. 


      • Greg_Deckler's avatar
        Greg_Deckler
        Icon for Community Champion rankCommunity Champion

        maracles - Try the combined Column and Line chart, that allows you to have your own hierarchy and it works for a line graphic, just don't put anything in your Column area.