Forum Discussion

Nicole_H's avatar
Nicole_H
Frequent Visitor
2 years ago
Solved

Dax to Power Query

I've spent way too long on this, and can't get it to work.  Can anyone covert this Dax into PowerQuery please?  I am not sure if it can be done.   The DAX code repeats [Extract_Measure] for each ID...
  • aduguid's avatar
    2 years ago

    I updated my answer, hope this works for you 

     

    let
        Source = TableName,
        GroupedTable = Table.Group(Source, {"ID"}, {
            {"NewMeasure", each 
                let
                    form_id = Table.FirstN(_, 1){0}[ID],
                    FilteredTable = Table.SelectRows(Source, each [ID] = form_id and [Answer] = _[Extract_Measure]{0}),
                    MaxValue = List.Max(FilteredTable[Extract_Measure])
                in
                    MaxValue
            }
        })
    in
        GroupedTable