Forum Discussion
Switch X Axis column through a slicer filter
Hi htaunay
One method is to do someting similar to what Anonymous did here:
http://tinylizard.com/dynamically-changing-chart-axis/
In your case, you would need to start with a DateTime table with datetime/day/month/year columns, which you then unpivot, and add a column identifying the granularity. The resulting table (let's call it DateTimeGranularity) provides a many-to-many relationship between DateTime and the values you want on your axis at the different levels of granularity.
You also need to add a column to enforce sort order.
In Power BI, you can then create a bi-directional relationship between the DateTimeGranularity table and the DateTime table, so that filtering on the Time Granularity column (DateTime, Date etc) also filters the DateTime table.
I've uploaded a dummy pbix file illustrating this which should make it clearer:
https://www.dropbox.com/s/aoflh2unznifyac/DateTime%20Granularity%20Selection.pbix?dl=1
The data model looks like this:
Note: you can also use drilldown on visualizations if you have a hierarchy of axis labels - I added another tab in the file illustrating this.
Owen :)
OwenAuger Thanks for this idea it works very well except in the situation I ran into. you can see my post below. thanks for this !
- Seward125338 years ago
Solution Sage
Try using multiple charts that you selectively show/hide with bookmarks and selection pane and use buttons to switch between them. I use this method extensively.
So you woudl have 5 version of the chart and create bookmarks with only one of these shown. Then create buttons linked to those bookmarks. (tip when saving bookmark be sure to uncheck the data propery of the bookmark so it only remembers which visuals to display and does not reset any filters.
- mws58728 years ago
Helper II
no, because the next step is to include charts with dynamic labels if that make sense. say breakdown by products on the label or by regions on the labels. so then it would be 5 X the number of breakdowns. so just for those two I mentioned I would need 10 charts....
5 for the dates X 2 diferent types ( I am planning more than 2.... probably 8 different mix types..
- Seward125338 years ago
Solution Sage
Why not just teach people how to use drill down capability of the charts and matricies to switch what is displayed?