Forum Discussion
Need help with bar chart
- 6 years ago
Anonymous
Please watch attached video for steps. *** Note: there are many ways of doing it.
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.
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.
- itsmebvk6 years agoContinued 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.- Anonymous6 years agoNot applicable
Thanks for the instructions! Based on the below I'm thinking perhaps my data is not set up correctly for Power BI... it is currently in this format:
Will this still work for what I'm trying to do?
- itsmebvk6 years agoContinued Contributor
Anonymous
Please watch attached video for steps. *** Note: there are many ways of doing it.