Forum Discussion
Dynamic Dimension in Bar Chart x-axis
- 1 year ago
Thankyou, danextian, for your response.
Hi pbiforum_123,We appreciate your question on the Microsoft Fabric Community Forum.
From what I understand, you want to switch the X-axis between Fact1[Year] and Fact2[Year] based on a slicer selection, but without using Field Parameters. Since Power BI does not allow changing the X-axis dimension dynamically using only DAX, we have implemented a workaround using data modeling.
Kindly find the steps below to resolve the issue:
- Combine Fact1 and Fact2 tables using Power Query Append Queries to create a single table.
- Create a slicer using a Threshold Unit table.
- Use a DAX measure to filter data according to the slicer selection.
- Plot Year on the X-axis and the filtered Sales measure on the Y-axis.
This way, you can switch the dimension dynamically without using Field Parameters.
Please see the attached screenshot and sample pbix file for your reference:
We hope this helps you solve the issue. If you have any more questions, feel free to ask the Microsoft Fabric community.
Thank you.
Hi Anonymous
From the looks of it, you're trying to create a calculated column using a slicer selection from SelectedDimension. That won’t work as calculated columns (and tables) don’t respond to slicers. Their values are fixed when the data is loaded or refreshed, so they won’t update based on user selections.
We may be able provide you with a workaround but we need a sample data (not an image), your expected result from the same sample data and your reasoning behind. You may post a link to Excel or a sanitized copy of your PBIX stored in the cloud.
- Anonymous1 year agoNot applicable
danextian I am not creating the calculated column. It is a direct column from a table only. Based on the selectedvalue of a slicer i wanted to control the dimension.
- danextian1 year ago
Super User
You are trying to switch between dimensions using DAX exression which is not possible. Values from both columns must exist in a single column with another column to identify which row goes to a specific slicer selection. Please refer to v-pnaroju-msft's response. This should be possible though and pretty simple with Field Parameters - Let report readers use field parameters to change visuals (preview)