Forum Discussion

Ivo78's avatar
Ivo78
Regular Visitor
2 years ago
Solved

Calculating delivery performance

I am working on creating a report focusing on undelivered shipments. But now I'm getting stuck in the dax formulas and not getting my calculation right. First, I created the following measures to calculate the successful deliveries and undelivered shipments.
 
1 Delivery succesful = CALCULATE(COUNTROWS(Deliveries),FILTER(Deliveries,Deliveries[Status] = "i" ||Deliveries[Status]="O"||Deliveries[Status]="Z"))
 
2 Not deliverd = COUNTA('Deliveries'[DeliveryID]) - [Delivery succesful]
Then I made a measure for a delivery performance
 
delivery performance = DIVIDE(SUM(Deliveries[DeliveryID]),CALCULATE(SUM(Deliveries[DeliveryID]),ALL(Deliveries)))
 

 

 Updating Media
Only my calculation is not correct and it shows 100%. To get the focus on the undelivered shipments,
I actually want to calculate the percentage undelivered using the column not deliverd. But this dax measure won't work. Furthermore,
I thought to get a correct percentage I should make a measure with True or False but don't know how to make this formula.
 
I was curieus of my thoughts on the calculation are correct. And i woud be happy to hear wat i can improve to get  the calculation right.
 

  • Anonymous's avatar
    Anonymous
    2 years ago

    Hi Ivo78 ,

     

    According to your description, here are my steps you can follow as a solution.

    (1) We can create a measure. 

    delivery performance = 
    var _a=[Delivery succesful]
    var _b=[Delivery succesful]+[Not deliverd]
    return DIVIDE(_a,_b,0)

    (2) Then the result is as follows.

    If the above one can't help you get the desired result, please provide some sample data in your tables (exclude sensitive data) with Text format and your expected result with backend logic and special examples. It is better if you can share a simplified pbix file. Thank you.

     

    Best Regards,

    Neeko Tang

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

  • Anonymous's avatar
    Anonymous
    2 years ago

    Hi Ivo78 ,

     

    Please check this line of code. there is no ONWAAR() function in dax.

      'DeliveriesStatus'[Culpable]] = ONWAAR()

    You can create this measure if you want to calculate the error percentage.

    FalsePercentage = 
    var _a=[Not deliverd]
    var _b=[Delivery succesful]+[Not deliverd]
    return DIVIDE(_a,_b,0)

    If the above one can't help you get the desired result, please provide some sample data in your tables (exclude sensitive data) with Text format and your expected result with backend logic and special examples. It is better if you can share a simplified pbix file. Thank you.

     

    Best Regards,

    Neeko Tang

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

     

6 Replies

  • Anonymous's avatar
    Anonymous
    Not applicable

    Hi Ivo78 ,

     

    According to your description, here are my steps you can follow as a solution.

    (1) We can create a measure. 

    delivery performance = 
    var _a=[Delivery succesful]
    var _b=[Delivery succesful]+[Not deliverd]
    return DIVIDE(_a,_b,0)

    (2) Then the result is as follows.

    If the above one can't help you get the desired result, please provide some sample data in your tables (exclude sensitive data) with Text format and your expected result with backend logic and special examples. It is better if you can share a simplified pbix file. Thank you.

     

    Best Regards,

    Neeko Tang

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

    • Ivo78's avatar
      Ivo78
      Regular Visitor

       

      Hi Neeko Tang

       

      Thanks for youre help.

      With thuis measure i can cleary see my % succesful deliveries. If i got right i can now get the correct % by maling a measure with true or false. I have search and created the following pleasure. Only i get a message chat the end of the input has been reached.

       

      FalsePercentage =
      VAR totalRows = COUNTROWS('DeliveriesStatus')
      VAR falseRows =
        CALCULATE (
          COUNTROWS('DeliveriesStatus'),
          'DeliveriesStatus'[Culpable]] = ONWAAR()
        )

      RETURN DIVIDE(falseRows,totalRows))))
       
      Are my thoughts on the calculation correct? Or must i look for another solution.

       

      • Anonymous's avatar
        Anonymous
        Not applicable

        Hi Ivo78 ,

         

        Please check this line of code. there is no ONWAAR() function in dax.

          'DeliveriesStatus'[Culpable]] = ONWAAR()

        You can create this measure if you want to calculate the error percentage.

        FalsePercentage = 
        var _a=[Not deliverd]
        var _b=[Delivery succesful]+[Not deliverd]
        return DIVIDE(_a,_b,0)

        If the above one can't help you get the desired result, please provide some sample data in your tables (exclude sensitive data) with Text format and your expected result with backend logic and special examples. It is better if you can share a simplified pbix file. Thank you.

         

        Best Regards,

        Neeko Tang

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

         

  • Please provide sample data (with sensitive information removed) that covers your issue or question completely, in a usable format (not as a screenshot). Leave out anything not related to the issue.
    If you are unsure how to do that please refer to https://community.fabric.microsoft.com/t5/Community-Blog/How-to-provide-sample-data-in-the-Power-BI-Forum/ba-p/963216
    Please show the expected outcome based on the sample data you provided.

    If you want to get answers faster please refer to https://community.fabric.microsoft.com/t5/Desktop/How-to-Get-Your-Question-Answered-Quickly/m-p/1447523