Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
2 years ago
Solved

Counting responses within multiples fields and combining into a column chart

I have a dataset (example below and ingested as a .csv file) that I need to represent as a column chart. Along the X axis I want to show each of the performed checks (headers of columns 3-8) and o...
  • parry2k's avatar
    2 years ago

    Anonymous you need to unpivot your data. Transform data -> select first two columns -> right click -> Unpivot other columns.

     

    It will give you two columns, attribute and value, rename these columns if you want. Close and apply.

     

    Add following measure:

     

    Fail Count = CALCULATE ( COUNTROWS ( Table ), Table[Value] = "Fail" )

     

    To visualize, use attribute on x-axis and above measure (Fail Count) on values and that will do it.

     

  • katika555's avatar
    2 years ago

    Hi,
    you can produce with switch and static table:

    1. create 5 measures for your columns : 

    Cnt COL = CALCULATE(COUNTROWS(DD),FILTER(DD, DD[Check Oil Lvl]="Fail"))
    Cnt GG = CALCULATE(COUNTROWS(DD),FILTER(DD, DD[Grease Gun]="Fail"))
    Cnt Ins = CALCULATE(COUNTROWS(DD),FILTER(DD, DD[Inspection/Defect Book]="Fail"))
    ....

    2. Create Table with Colun Names and Ordering what you want

    3. Create Measure with Switch:

    Mes Matrix = 
     SWITCH(
         SELECTEDVALUE(ForSwitch[ColName]),
         "Check Oil Lvl",[Cnt COL],
         "Water Lvl",[Cnt WL],
         "Thorough Exam/Test Cert In Date", [Cnt TE],
         "Inspection/Defect Book", [Cnt Ins],
         "Grease Gun",[Cnt GG],
         "Rope Spray",[Cnt RS]
        )

    4. add on chart this way:

    5. 

     

    Enjoy Power BI