Forum Discussion

lotus22's avatar
lotus22
Helper III
2 years ago

Remove a entry in PowerBi based on next entry

 

In picture we have a machine RW100 Side A where fail entry created by Operator 10314. The operator was able to fix the late entry with in 5 mins as we see next entry 159. How do I remove the late entry from PowerBI or exclude it when the new entry shows up within 5 mins?

 

10314 is Operator ID. Minutes is (minutes between created and now) which do not mean anything here.

 

8 Replies

  • TheoC's avatar
    TheoC
    Community Champion

    Hi lotus22 

     

    I've done this in Power Query for you.

     

    There are two tables in the attached PBIX.  One is filtered (with the > 5 mins remaining).  The other keeps both >5 mins and <5 mins in but I've added a validation column for you.

     

    The approach I applied was:

     

    1. Create a new Custom Column to show the next entry with the same machine and operator.
    2. Calculated the time difference between the entries for the above.
    3. Filtered out entries with a time difference greater than 5 mins.

     

    Let me know if you need this in DAX otherwise the PQ version is attached.  

     

    Hope this helps! 🙂

     

    Theo

     

    • lotus22's avatar
      lotus22
      Helper III

      TheoC  Thank you so much! That was quick.

       

      We only need to validate if the previous entry is LATE and the next entry is on time. As soon as we get a Late entry for a particular machine, we must ensure another entry is on time within 5 minutes. If yes, then we delete the late entry; otherwise, it shows up.

       

      For instance, if 158, a late entry, appears and we know that 159, a non-late entry, follows within 5 minutes, we can 'exclude' 158. Our focus is solely on validating late entries. 

       

      It gets tricky. If RW100 Side A  has entry 158 that is late but there was no late entry, we include this on the graph. Now, after two hours, if RW100 Side A has another late entry, say 250, that will be a new validation but not part of 158.

  • TheoC's avatar
    TheoC
    Community Champion

    lotus22 I am pretty sure that's the logic applied in tblRemoved?  If not, can you do me a favour and highlight the exact output you want based on the rows you have in the sample data?

     

    • lotus22's avatar
      lotus22
      Helper III

      TheoC  The entries removed should only be late and not completed. The completed is good.

      • TheoC's avatar
        TheoC
        Community Champion

        Yes, lotus22.  I understand that.  That is what I did already in the 'tblRemoved' table for you in the PBIX file I attached earlier.  If this isn't the output you want, can you please tell me which rows are the output you want based on your sample data.