Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
5 years ago
Solved

Advanced Filtering to remove unmet measure data split in several rows but the same ID

Hello! My Goal: Capture the rows shown below where the PCR_ID has at least one non NV value entered into the columns "PulseOximetry" and "respiratory_rate" so I can identify if a healthcare measure was met.

 

Since one PCR_ID can have several Vital Signs done in one call, I need to count the ones where both where done but not the ones where just one is done and not the other. The EMT can log these in different row so that is my problem- I need to filter out the rows that do not have both PULSEOXIMETRY and Respiratory filled in but on some rows with the same PCR_ID they are logged on different lines.

EX: Lines 239 - measure met = keep

Lines 245 - Measure not met = Filter

Lines 13 and 14 = Measure met between two rows - Keep

 

  • Hi Anonymous ,

     

    Try the following formula:

     

    let
        Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("i45WsrRQ0lEyMgESiYlKsTrRSoYGBkCOIUg4KQksYmkJUmKAEPALszU3B/GNTYFEcjKSPiMjhAhcGdiOlBSEYXAZqCCcD2ekpirFxgIA", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [Pulse_Oximetry = _t, Respiratory_Rate = _t, PCR_ID = _t]),
        #"Changed Type" = Table.TransformColumnTypes(Source,{{"Pulse_Oximetry", type text}, {"Respiratory_Rate", type text}, {"PCR_ID", type text}}),
        #"Added Index" = Table.AddIndexColumn(#"Changed Type", "Index", 1, 1, Int64.Type),
        #"NV Table" = Table.FindText(#"Added Index","NV"),
        #"Difference" = List.Difference(#"Added Index"[Index],#"NV Table"[Index]),
        #"Contain Index" = Table.SelectRows(#"Added Index",each List.Contains(#"Difference",[Index])),
        #"Contain PCRID" = Table.SelectRows(#"Added Index",each List.Contains(#"Contain Index"[PCR_ID],[PCR_ID]))
    in
        #"Contain PCRID"

     


    If the problem is still not resolved, please provide detailed error information or the expected result you expect. Let me know immediately, looking forward to your reply.

    Best Regards,
    Winniz

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

     

     

  • Hi Anonymous ,

     

    Has your problem been solved? If it is solved, please mark a reply which is helpful to you.

     

    If the problem is still not resolved, please provide detailed error information or the expected result you expect. Let me know immediately, looking forward to your reply.

     

    Best Regards,
    Winniz

2 Replies

  • v-kkf-msft's avatar
    v-kkf-msft
    Icon for Community Support rankCommunity Support

    Hi Anonymous ,

     

    Try the following formula:

     

    let
        Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("i45WsrRQ0lEyMgESiYlKsTrRSoYGBkCOIUg4KQksYmkJUmKAEPALszU3B/GNTYFEcjKSPiMjhAhcGdiOlBSEYXAZqCCcD2ekpirFxgIA", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [Pulse_Oximetry = _t, Respiratory_Rate = _t, PCR_ID = _t]),
        #"Changed Type" = Table.TransformColumnTypes(Source,{{"Pulse_Oximetry", type text}, {"Respiratory_Rate", type text}, {"PCR_ID", type text}}),
        #"Added Index" = Table.AddIndexColumn(#"Changed Type", "Index", 1, 1, Int64.Type),
        #"NV Table" = Table.FindText(#"Added Index","NV"),
        #"Difference" = List.Difference(#"Added Index"[Index],#"NV Table"[Index]),
        #"Contain Index" = Table.SelectRows(#"Added Index",each List.Contains(#"Difference",[Index])),
        #"Contain PCRID" = Table.SelectRows(#"Added Index",each List.Contains(#"Contain Index"[PCR_ID],[PCR_ID]))
    in
        #"Contain PCRID"

     


    If the problem is still not resolved, please provide detailed error information or the expected result you expect. Let me know immediately, looking forward to your reply.

    Best Regards,
    Winniz

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

     

     

  • v-kkf-msft's avatar
    v-kkf-msft
    Icon for Community Support rankCommunity Support

    Hi Anonymous ,

     

    Has your problem been solved? If it is solved, please mark a reply which is helpful to you.

     

    If the problem is still not resolved, please provide detailed error information or the expected result you expect. Let me know immediately, looking forward to your reply.

     

    Best Regards,
    Winniz