Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Compete to become Power BI Data Viz World Champion! First round ends August 18th. Get started.

Reply
ElvirBotic
Helper III
Helper III

Change bar chart/line graph based off of user selection

Hello, 

I am working on creating a way to allow users to be able to view a set of questions in a single bar chart and their respective responses. Quick background, we have a survey that was completed and in the survey their are multiple sections. Each section has roughly 5-6 questions. What I want to be able to do is create a "button" similar to the page navigation button in Power BI, however I want it to display each of the sections and connect it to a bar graph which will display the questions associated with that section in the bar graph. 

Would this be done using bookmarks and multiple bar graphs or would I have to go the parameter route? 

1 ACCEPTED SOLUTION

Hi @ElvirBotic ,

Thank you for reaching out to us on the Microsoft Fabric Community Forum.

 

Please follow below steps.

Step 1: Created table (sample) with your sample data.

Step 2: Unpivot the Data

In Power Query (Transform Data): Select all columns (1a to 2c). Click Transform → Unpivot Columns.

Rename columns to Question (from Attribute) and Response (from Value).

Add a custom column to assign sections: Go to Add Column → Custom Column:

= if Text.StartsWith([Question], "1") then "Section 1"
else if Text.StartsWith([Question], "2") then "Section 2"
else null


Step 3: Create a Section Table

In Power BI, use "Enter Data" to create a disconnected table called SectionSelection:

Section
Section 1
Section 2

Note: Place this as a slicer or button toggle.

vdineshya_0-1748455889605.png

 

Step 4: Create a measure for selected section:

Selected Section = SELECTEDVALUE('SectionSelection'[Section])

Create a dynamic measure for numeric data :

Total Numeric Responses =
VAR _section = [Selected Section]
RETURN
CALCULATE(
SUMX(
FILTER('sample',
'sample'[Section] = _section &&
ISNUMBER('sample'[Response])
),
VALUE('sample'[Response])
)
)

Step 5: Create the Bar Chart and drag the below fields.

Y-axis: Question

X-axis: Total Numeric Responses

 

Please refer output snap and attached PBIX file.

vdineshya_1-1748455993013.png

If my response has resolved your query, please mark it as the "Accepted Solution" to assist others. Additionally, a "Kudos" would be appreciated if you found my response helpful.

Thank you

View solution in original post

8 REPLIES 8
v-dineshya
Community Support
Community Support

Hi @ElvirBotic ,

Thank you for reaching out to the Microsoft Community Forum.

Please provide sample data that covers your issue or question completely, in a usable format (not as a screenshot).
Do not include sensitive information. Do not include anything that is unrelated to the issue or question.
Please show the expected outcome based on the sample data you provided.


If my response has resolved your query, please mark it as the "Accepted Solution" to assist others. Additionally, a "Kudos" would be appreciated if you found my response helpful.

Thank you

Hi @ElvirBotic ,

Thank you for reaching out to the Microsoft Community Forum.

Please provide sample data that covers your issue or question completely, in a usable format (not as a screenshot).
Do not include sensitive information. Do not include anything that is unrelated to the issue or question.
Please show the expected outcome based on the sample data you provided.


If my response has resolved your query, please mark it as the "Accepted Solution" to assist others. Additionally, a "Kudos" would be appreciated if you found my response helpful.

Thank you

Hi @ElvirBotic ,

Thank you for reaching out to the Microsoft Community Forum.

Please provide sample data that covers your issue or question completely, in a usable format (not as a screenshot).
Do not include sensitive information. Do not include anything that is unrelated to the issue or question.
Please show the expected outcome based on the sample data you provided.


If my response has resolved your query, please mark it as the "Accepted Solution" to assist others. Additionally, a "Kudos" would be appreciated if you found my response helpful.

Thank you

Ritaf1983
Super User
Super User

Hi @ElvirBotic 

It sounds like your scenario could potentially be handled using Field Parameters, or dynamic measures controlled by slicers, or even other approaches. However, it’s quite difficult to give a more targeted answer without seeing your data model and the exact result you’re trying to achieve.

I recommend creating a small PBIX file that replicates your structure and includes a visual example of your desired outcome. Then share it via a public cloud service, so others can better understand your setup and offer more precise guidance.

If this post helps, then please consider Accepting it as the solution to help the other members find it more quickly

Regards,
Rita Fainshtein | Microsoft MVP
https://www.linkedin.com/in/rita-fainshtein/
Blog : https://www.madeiradata.com/profile/ritaf/profile

What I want is when a user selects a section which in this case i made into a button to only display the questions associated with section 1 and if they select another section of questions to display the results in a bar graph. 

ElvirBotic_0-1747794984813.pngElvirBotic_1-1747795005591.png

 

Thanks for sharing, but unfortunately, from your screenshots it's not entirely clear what you're trying to achieve. It's also very hard to work with images instead of actual data.

To help you effectively, please provide:

  1. A clear explanation of the logic behind your goal — what you're trying to show or switch between.

  2. A sample image of the desired result for each selection (e.g., what should be shown when Section 1 is selected, and what changes when switching to Section 2).

  3. A link to a sample PBIX file uploaded to any public cloud (OneDrive, Google Drive, etc.) so we can see the actual structure and build a relevant solution.

This will help avoid misunderstandings and allow the community to provide more accurate and helpful answers.

Regards,
Rita Fainshtein | Microsoft MVP
https://www.linkedin.com/in/rita-fainshtein/
Blog : https://www.madeiradata.com/profile/ritaf/profile

Okay, 

I want to be able to allow users to display the resules for a certain section. One section may have 4 questions (columns) while another may have 5, 6, or more. How would i be able to allow users to dynmically chnage to see the different results for each section in the y axis? 

I added my very simple .pbix. I just want to understand the functionality. 
https://drive.google.com/file/d/1jXRvudsp0FF8CdHJ2Xia6PbnXIdVC4aa/view?usp=sharing

Hi @ElvirBotic ,

Thank you for reaching out to us on the Microsoft Fabric Community Forum.

 

Please follow below steps.

Step 1: Created table (sample) with your sample data.

Step 2: Unpivot the Data

In Power Query (Transform Data): Select all columns (1a to 2c). Click Transform → Unpivot Columns.

Rename columns to Question (from Attribute) and Response (from Value).

Add a custom column to assign sections: Go to Add Column → Custom Column:

= if Text.StartsWith([Question], "1") then "Section 1"
else if Text.StartsWith([Question], "2") then "Section 2"
else null


Step 3: Create a Section Table

In Power BI, use "Enter Data" to create a disconnected table called SectionSelection:

Section
Section 1
Section 2

Note: Place this as a slicer or button toggle.

vdineshya_0-1748455889605.png

 

Step 4: Create a measure for selected section:

Selected Section = SELECTEDVALUE('SectionSelection'[Section])

Create a dynamic measure for numeric data :

Total Numeric Responses =
VAR _section = [Selected Section]
RETURN
CALCULATE(
SUMX(
FILTER('sample',
'sample'[Section] = _section &&
ISNUMBER('sample'[Response])
),
VALUE('sample'[Response])
)
)

Step 5: Create the Bar Chart and drag the below fields.

Y-axis: Question

X-axis: Total Numeric Responses

 

Please refer output snap and attached PBIX file.

vdineshya_1-1748455993013.png

If my response has resolved your query, please mark it as the "Accepted Solution" to assist others. Additionally, a "Kudos" would be appreciated if you found my response helpful.

Thank you

Helpful resources

Announcements
August Power BI Update Carousel

Power BI Monthly Update - August 2025

Check out the August 2025 Power BI update to learn about new features.

August 2025 community update carousel

Fabric Community Update - August 2025

Find out what's new and trending in the Fabric community.

Top Solution Authors