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

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

Reply
Brndn
New Member

Need help with counting the amounts yes, no and partly

Hi,

 

I'm facing some problems when trying to count the amounts yes, no and partly for all the questions in one. 

My goal is to visualize the amounts of yes, no and partly through a bar/pie chart en be able to filter it with the first three columns. 

 

So in the example below, the total amount of yes is 12, no 14 and partly 5 should be showed through the bar/pie chart.

 

CountryRegionTypeQuestion 1Question 2Question 3Question 4Question 5Question 6
The NetherlandsNorthSupermarketYesYes   No
The NetherlandsWestCinemaNoYesPartly YesNo
The NetherlandsEastCinema Yes NoNoPartly
The NetherlandsSouthSupermarketNo  No  
BelgiumNorthSupermarket  partlyNoNoNo
BelgiumWestCinemaYesNo YesYesYes
BelgiumEastCinema NoNoYesPartlyYes
BelgiumSouthSupermarketPartly Yes  No

 

Thanks in advance!!

1 ACCEPTED SOLUTION
Anonymous
Not applicable

Hi @Brndn ,

 

Select 6 question columns and click unpivot feature in Query Editor and you will get a new table.

9.PNG

Then create visuals as below.

10.PNG

 

Best Regards,

Jay

View solution in original post

3 REPLIES 3
Anonymous
Not applicable

Hi @Brndn ,

 

Select 6 question columns and click unpivot feature in Query Editor and you will get a new table.

9.PNG

Then create visuals as below.

10.PNG

 

Best Regards,

Jay

Thank you so much! Exactly what I was looking for

DataInsights
Super User
Super User

@Brndn,

 

Try this solution.

 

1. Unpivot the Question columns in Power Query:

 

let
  Source = Table.FromRows(
    Json.Document(
      Binary.Decompress(
        Binary.FromText(
          "dZHPCsMgDMZfRTz3KTZ2lUEHY5QehIVZprX457C3b6u2apcejET8fsmXdB19CCAMnAAj+fi2tKFMGyeWu/UTGMXNF9ySvcDukRSHado3GOYJdtVdhxEUjx83/Z0bJ38JEJ9OMTdeY0jVRYCGkJg4pNUesRR0pCTFZGVcQH4Gr07HscmmzUruJFnJhOMkdselmxxrMeY/1zrM81+OO0cWUO6znwE=", 
          BinaryEncoding.Base64
        ), 
        Compression.Deflate
      )
    ), 
    let
      _t = ((type nullable text) meta [Serialized.Text = true])
    in
      type table [
        Country = _t, 
        Region = _t, 
        Type = _t, 
        #"Question 1" = _t, 
        #"Question 2" = _t, 
        #"Question 3" = _t, 
        #"Question 4" = _t, 
        #"Question 5" = _t, 
        #"Question 6" = _t
      ]
  ), 
  ChangeType = Table.TransformColumnTypes(
    Source, 
    {
      {"Country", type text}, 
      {"Region", type text}, 
      {"Type", type text}, 
      {"Question 1", type text}, 
      {"Question 2", type text}, 
      {"Question 3", type text}, 
      {"Question 4", type text}, 
      {"Question 5", type text}, 
      {"Question 6", type text}
    }
  ), 
  UnpivotColumns = Table.UnpivotOtherColumns(
    ChangeType, 
    {"Country", "Region", "Type"}, 
    "Attribute", 
    "Value"
  ), 
  RenameColumns = Table.RenameColumns(UnpivotColumns, {{"Attribute", "Question"}}), 
  FilterBlanks = Table.SelectRows(RenameColumns, each ([Value] <> " "))
in
  FilterBlanks

 

2. Create measure:

 

Count Value = COUNT ( Questions[Value] )

 

DataInsights_0-1621786126770.png

 





Did I answer your question? Mark my post as a solution!

Proud to be a Super User!




Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!

November Power BI Update Carousel

Power BI Monthly Update - November 2025

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

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.