Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
2 years ago
Solved

Convert DAX to Power M Query

First time trying to convert DAX to Power M Query and having a hard time getting started/finding exactly what I need in the help documents. Can someone help me convert this?  And are there any resour...
  • Anonymous's avatar
    Anonymous
    2 years ago

    Hi Anonymous 

    You can use group by in power query to count rows, you can refer to the folloing link.

    Group rows of data (Power Query) - Microsoft Support

    You can put the following code to advanced editor in power query to as a sample

    let
        Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("i45WMlTSUUpUitVBZyXBWclglhFc1gguawSRjQUA", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [ID = _t, Type = _t]),
        #"Changed Type" = Table.TransformColumnTypes(Source,{{"ID", Int64.Type}, {"Type", type text}}),
        #"Grouped Rows" = Table.Group(#"Changed Type", {"ID", "Type"}, {{"Count", each Table.RowCount(_), Int64.Type}})
    in
        #"Grouped Rows"

     

    Best Regards!

    Yolo Zhu

    If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.