Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
2 years ago
Solved

Pass fail count from total count group by

HI I have 2 columns device name and device status. The device status has values pass,fail and app exception. I have to group devices based on number of occcurance of each device for which i did usin...
  • ManuelBolz's avatar
    2 years ago

    Hello Anonymous,

     

    Do you perhaps have a screenshot or sample data so that the community can get a better idea of ​​your problem?

    Or maybe this little example will help you:

    let
        //Replace the first Step with your Data Table
        //Source = YourDataTable
        Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("i45W8kksKMkvUNJRKkgsLlaK1YlWCk7NK84vQhZxySwuyEmsRBZyTgSpSEvMzAFznTKzU5GlAzLy81KRFfhmJiNzPVITUwpQ1MQCAA==", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [#"Device Name" = _t, #"Device Status" = _t]),
    
        Type = Table.TransformColumnTypes(Source,{{"Device Name", type text}, {"Device Status", type text}}),
        Grouped = Table.Group(Type, {"Device Name", "Device Status"}, {{"Count", each Table.RowCount(_), Int64.Type}}),
        Pivoted = Table.Pivot(Grouped, List.Distinct(Grouped[Device Status]), "Device Status", "Count", List.Sum)
    in
        Pivoted


    Best regards from Germany
    Manuel Bolz


    🟦Follow me on LinkedIn
    🟨How to Get Your Question Answered Quickly
    🟩Fabric Community Conference
    🟪My Solutions on Github

  • Anonymous's avatar
    Anonymous
    2 years ago

    Please find the below screen shots , this is the original table

    Below is the table after grouping

    The transformation i used to group device name based on device status da_status is as below.

    = Table.Group(dbo_vw_ehas_dashboard, {"device_name", "da_status"}, {{"device_dastatus", each Table.RowCount(_), Int64.Type}})