Forum Discussion
Need help with bar chart
Hi,
New to Power BI here.
If I have 20 Likert scale survey questions, can I create a dynamic bar chart that displays the agree/disagree response count for one question at a time? i.e. if I choose "question1" it will show the response counts for question1 but no other questions.
And then I can select "question2" to view only the response counts for question 2 etc. Example image of graph below.
I'm not sure whether to use a slicer or filter?
Thank you kindly
Ang
Anonymous
Please watch attached video for steps. *** Note: there are many ways of doing it.
10 Replies
- itsmebvk
Continued Contributor
Anonymous
There are many of ways of doing it. I am not infront of system, but I belive you can create two measures using follwing expression.
Like Count =
SWITCH(
SELECTEDVALUE([survey questions])
,1, CALCULATE(COUNT([Like and Dislike column]),FILTER(Table,[Like and Dislike column] = "Like" && [survey questions]=1))
,2, CALCULATE(COUNT([Like and Dislike column]),FILTER(Table,[Like and Dislike column] = "Like" && [survey questions]=2))
,3, CALCULATE(COUNT([Like and Dislike column]),FILTER(Table,[Like and Dislike column] = "Like" && [survey questions]=3))
, CALCULATE(COUNT([Like and Dislike column]),FILTER(Table,[Like and Dislike column] = "Like" && [survey questions]=1))
)DisLike Count =
SWITCH(
SELECTEDVALUE([survey questions])
,1, CALCULATE(COUNT([Like and Dislike column]),FILTER(Table,[Like and Dislike column] = "DisLike" && [survey questions]=1))
,2, CALCULATE(COUNT([Like and Dislike column]),FILTER(Table,[Like and Dislike column] = "DisLike" && [survey questions]=2))
,3, CALCULATE(COUNT([Like and Dislike column]),FILTER(Table,[Like and Dislike column] = "DisLike" && [survey questions]=3))
, CALCULATE(COUNT([Like and Dislike column]),FILTER(Table,[Like and Dislike column] = "DisLike" && [survey questions]=1))
)Use them in chart. Please let me know how it goes.
- AnonymousNot applicable
Hey thanks for your reply. I'm really very new to Power BI and coding, would it be possible to break down the instructions further or link a video tutorial that demonstartes how to do this?
Thanks very much.
- itsmebvk
Continued Contributor
Anonymous I am sorry I am not sure how to create video and link. Please follow below steps.
1)Assume that you have following data
2)Then Open Power BI Desktop, create a mesure as follows
3) Use following expression
Measure = count(Sheet1[Answer])4)Then select Answers and New Measure columns to chart as highlighted below5) Then select slicer as highlighted in 5step, then assign Question column to this.Now should be able to play with it.
- VijayP
Community Champion
I have used a slicer and connected the slicer to the Chart with SELECTEDVALUE function. if you find this as solution , I can share the Video to understand how to do it!!- AnonymousNot applicable
This looks very promising! Could you please share the video on how to do this? Thanks very much.
- VijayP
Community Champion
Anonymous wrote:This looks very promising! Could you please share the video on how to do this? Thanks very much.
https://drive.google.com/open?id=1WRCzlb4lasREhUHk5ErRRMU-kAG3Krty
Please download the link of Pbix File. Will share the video in some time.
- VijayP
Community Champion