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

Grow your Fabric skills and prepare for the DP-600 certification exam by completing the latest Microsoft Fabric challenge.

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
v-jayw-msft
Community Support
Community Support

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

Community Support Team _ Jay
If this post helps, then please consider Accept it as the solution
to help the other members find it.

View solution in original post

3 REPLIES 3
v-jayw-msft
Community Support
Community Support

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

Community Support Team _ Jay
If this post helps, then please consider Accept it as the solution
to help the other members find it.

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
Europe Fabric Conference

Europe’s largest Microsoft Fabric Community Conference

Join the community in Stockholm for expert Microsoft Fabric learning including a very exciting keynote from Arun Ulag, Corporate Vice President, Azure Data.

RTI Forums Carousel3

New forum boards available in Real-Time Intelligence.

Ask questions in Eventhouse and KQL, Eventstream, and Reflex.

MayPowerBICarousel1

Power BI Monthly Update - May 2024

Check out the May 2024 Power BI update to learn about new features.