Forum Discussion
Creating relationships for one long dataset
To create the desired interaction between the visuals, you can utilize the "slicer" functionality in Power BI. You don't necessarily need to create relationships between tables in this case since all the data is in a single table.
Here's how you can achieve the desired result:
Add two bar chart visuals to your report.
In the first bar chart, use "State" (which you can get by filtering the "Question" column) as the axis and "Count" as the value.
In the second bar chart, use "Income Bracket" (which you can get by filtering the "Question" column) as the axis and "Count" as the value.
Add a slicer visual to your report to filter by Income Bracket:
In the slicer, use a measure that filters the "Answer" column based on the selected "Question" for the Income Bracket.
Create a measure like this:
Income Bracket Answer =
CALCULATE (
SELECTEDVALUE ( YourTableName[Answer] ),
YourTableName[Question] = "Income Bracket Question"
)
Replace "Income Bracket Question" with the actual question text related to income brackets.
Add another slicer visual to your report to filter by State:
In the slicer, use a measure that filters the "Answer" column based on the selected "Question" for the State.
Create a measure like this:
State Answer =
CALCULATE (
SELECTEDVALUE ( YourTableName[Answer] ),
YourTableName[Question] = "State Question"
)
Replace "State Question" with the actual question text related to states.
Now, when you select an income bracket in the first slicer, it will filter the data in both bar charts based on the selected income bracket. Similarly, when you select a state in the second slicer, it will filter the data in both bar charts based on the selected state. This way, you can see the intersection of income brackets and states in your visuals.