0

Recently I came up with this problem: I have a table with two different codes: COD1 and COD2. I want to create in power bi bar charts and tables with this information but I want to be able to change whether if I want to see them with COD1 or COD2. I have a slicer that gives you the option of which code you want the info be displayed. I've done this before with numeric data types because you can do this with a measure, however I don't know how to make it work with non-numeric columns.

COD1 COD2 Sales
AA A10 5
AB B45 10
CD D44 20

1 Answer 1

0

I'm not exactly sure what you're trying to achieve but if I understand you correctly, you can change columns on a bar chart by making two bar charts. One will have COD1 as an axis with Sales, and the other will have COD2 as an axis with the same sales metric.

You could then use buttons and the bookmark functionality of Power BI to seamlessly "switch" the axis. See an example below:

enter image description here

Sign up to request clarification or add additional context in comments.

2 Comments

Yes, that's what I want exactly. However, is there another way to do it instead of bookmarks?
Technically, yes. In Power Query, you could unpivot both the COD1 and COD2 columns, then build a slicer off that new column with the Values as the axis and the Sales column as the other axis. But that would not be an optimal solution as it could lead to other issues in your data model and misleading totals (especially on the Sales column that will be doubled in the unpivot). I wouldn't recommend it. Unfortunately, there's just no easy way to accomplish what you are looking for in Power BI currently.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.