Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
5 years ago
Solved

Need help with M-Query in Advanced editor

Hi Community,   I have Web As data source report . After working on m-query in advanced editor and applying lot of transformation steps (Combined list, Converting list to table, expanding columns e...
  • v-alq-msft's avatar
    5 years ago

    Hi, Anonymous 

     

    Based on your description, I created data to reproduce your scenario.

    Source:

     

    = Table.FromRecords(
            {
                [Data={null,#date(2020,1,1)}],
                [Data={null,#date(2020,1,2)}],
                [Data={null,#date(2020,1,3)}],
                [Data={null,#date(2020,1,4)}],
                [Data={null,#date(2020,1,5)}],
                [Data=#date(2020,1,6)],
                [Data=#date(2020,1,7)]
            }
        )

     

     

     

    You may add a new step as below.

     

    = Table.TransformColumns(Source, {"Data",each if _ is list 
    then List.Max( List.RemoveNulls(_) )
    else if _ is date 
    then _
    else null
    }
    )

     

     

    Result:

     

    Best Regards

    Allan

     

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