Forum Discussion
Chart shows more years than in data
Hi everybody!
I'm having a regular LINE AND STACKED COLUMN CHART, populated with data from the years 2008 to 2019. The years are on the x-axis of the chart. The problem is that one the chart I see the range from 2005 to 2022 on the x-axis with the years 2005 to 2007 and 2019 to 2022 empty, i.e., without values. How can I tell PowerBI to show only the years I have data for?
Thank you
Christoph
Hi,
Try this:
Go to the visual option> Sort by > Order Year
You need to convert the X axis to Categorical.
Rgds,
Vivek
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
9 Replies
- vivran22
Community Champion
Hi Christoph,
There are two graph settings which could help:Under Fields > Axis > Do not select the Date Hierarchy/Select the date instead
Under Format > X Axis > Type > Categorical (by default it is continuous)Hope this should solve the purpose.
Thanks,Vivek
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.- ChristophEmrichFrequent Visitor
Thank you for the quick response.
Under Fields > Axis > Do not select the Date Hierarchy/Select the date instead
I don't find this in the visualization. You will find what I see in PowerBI in the attached picture. I should add that I have the "Year" as a whole number, not a date.
Under Format > X Axis > Type > Categorical (by default it is continuous)If I do this, the empty years disappear but the sorting of the year reverses, i.e., 2019 is on the left of the axis and 2008 is on the right. Can I reverse this somehow?
- vivran22
Community Champion
Is it possible to share the sample data/pbix file? I will have better understanding of the situation.
Thanks,
Vivek