Forum Discussion

lennox25's avatar
lennox25
Icon for Post Patron rankPost Patron
2 years ago
Solved

How to work out % Over Deadline

Out of total no of products delivered. I need to know how many were sold within the Deadline Date. I extracted from PBI into Excel to show you what I require and worked out but cant figure how to do it in power bi. Help very much appreciated! Thank you!

 

 

  • Anonymous's avatar
    Anonymous
    2 years ago

    Hi lennox25 ,

    You can create a meausre as below to get it:

    Over Deadline Percentage = 
    VAR _all =
        CALCULATE ( COUNT ( 'Table'[Date Arrived] ), ALLSELECTED ( 'Table' ) )
    VAR _delay =
        CALCULATE (
            COUNT ( 'Table'[Date Arrived] ),
            FILTER ( ALLSELECTED ( 'Table' ), 'Table'[Days Over Deadline] >= 0 )
        )
    RETURN
        DIVIDE ( _delay, _all )

    Best Regards

6 Replies

  • PijushRoy's avatar
    PijushRoy
    Icon for Community Champion rankCommunity Champion

    Hi lennox25 

    Please use the DAX

     

    = VAR _TotalCount = COUNTROWS(Table)
    VAR _Overdeadlinecount = Calculate(Count(table[Days Over Deadline]),table[Days Over Deadline]>=0)
    RESULT
    DIVIDE(_Overdeadlinecount,_TotalCount)

     

     


    Let me know if that works for you


    If your requirement is solved, please mark THIS ANSWER as SOLUTION ✔️ and help other users find the solution quickly. Please hit the LIKE 👍 button if this comment helps you.

    Thanks
    Pijush
    Linkedin

      • PijushRoy's avatar
        PijushRoy
        Icon for Community Champion rankCommunity Champion

        Hi lennox25 

        My bad, I mentioned RESULT instead of RETURN

        Measure = VAR _TotalCount = COUNTROWS(Table)
        VAR _Overdeadlinecount = Calculate(Count(table[Days Over Deadline]),table[Days Over Deadline]>=0)
        RETURN
        DIVIDE(_Overdeadlinecount,_TotalCount)

         

        If your requirement is solved, please mark THIS ANSWER as SOLUTION

    • lennox25's avatar
      lennox25
      Icon for Post Patron rankPost Patron

      Yes, but when I work it on excel it has different % to whats on PBI ad I dont know why Measure 2 (the one you provided is coming out at 100% for all the over deadline ?

       

      • Anonymous's avatar
        Anonymous
        Not applicable

        Hi lennox25 ,

        You can create a meausre as below to get it:

        Over Deadline Percentage = 
        VAR _all =
            CALCULATE ( COUNT ( 'Table'[Date Arrived] ), ALLSELECTED ( 'Table' ) )
        VAR _delay =
            CALCULATE (
                COUNT ( 'Table'[Date Arrived] ),
                FILTER ( ALLSELECTED ( 'Table' ), 'Table'[Days Over Deadline] >= 0 )
            )
        RETURN
            DIVIDE ( _delay, _all )

        Best Regards