Forum Discussion

majid154a's avatar
majid154a
Icon for Helper II rankHelper II
2 years ago
Solved

Average & achieve target

  Hello experts, I have delivery company data that includes metrics such as minutes for the driver to reach the restaurant, minutes for the driver to deliver the order, and minutes for the driver t...
  • Anonymous's avatar
    Anonymous
    2 years ago

    Hi majid154a ,

    Based on my testing, for the first question, please try the following methods:

    1.Create the measure to calculate the average for each metrics.

     

    Average MinutesToPickup = AVERAGE('Table'[MinutesToPickup])
    Average MinutesToHandOver = AVERAGE('Table'[MinutesToHandOver])
    Average MinutesToArrive = AVERAGE('Table'[MinutesToArriveAtCustomer])

     

    2.Drag the measures to the column chart.

    For the second question, create the new measure to filter the target for each zone.

     

    TargetMinutesToPickup = 
    var _pickupminute = SELECTEDVALUE('Table'[MinutesToPickup])
    var _zone = SELECTEDVALUE('Table'[Zone])
    RETURN
    IF(_pickupminute <= 20 && _zone = "A", "Yes", 
        IF(_pickupminute < 15 && _zone = "B", "Yes", "No")
    )
    Achieve goal = 
    var _achievegoal = CALCULATE(COUNTROWS('Table'), FILTER('Table', [TargetMinutesToPickup] = "Yes"))
    var _goal = CALCULATE(COUNTROWS('Table'), ALLEXCEPT('Table', 'Table'[Zone]))
    var result = DIVIDE(_achievegoal, _goal)
    RETURN
    IF(result = 0, 0 , result)

     

    Then, drag the measure to the column chart.


     

    Best Regards,

    Wisdom Wu

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