Forum Discussion

syaiful_fcpc's avatar
syaiful_fcpc
Frequent Visitor
2 years ago
Solved

Getting Datediff between date time , Getting Average and Getting of KPI ( Miss and Hit )

Dear Powerbi Master Im new in this things, i have some task which i have some doubt to do analytic.  here , i have table (attached),  HTM NUMBER X.DELIVERYDATE X.ACTDELIVTRUCKING X.ATACCST...
  • v-weiyan1-msft's avatar
    2 years ago

    Hi syaiful_fcpc ,

     

    Based on the sample and description you provided, Please try the following steps:

    Target1. Create a column (CCWH) to get Datediff.

    CCWH = DATEDIFF('Table'[X.CCFINISHDATE],'Table'[X.ACTDELIVTRUCKING],HOUR)

    Target 2. Create a column (ATACC) to get Datediff.

    ATACC = DATEDIFF('Table'[X.ATACCSTARTDATE],'Table'[X.CCFINISHDATE],HOUR)

    Target 3. Getting Average Hour point 1.

    Avg_CCWH = AVERAGE('Table'[CCWH])

    Target 4. Getting Average Hour point 2.

    Avg_ATACC = AVERAGE('Table'[ATACC])

    Target 5.

    Measure1 = IF(SELECTEDVALUE('Table'[Avg_CCWH]) < MAX('Table'[ATACC]),
                 "Hit",
                 "Miss")
    

    Target 6.

    Measure2 = IF(SELECTEDVALUE('Table'[Avg_ATACC]) < MAX('Table'[ATACC]),
                 "Hit",
                 "Miss")
    

    Target 7.

    Avg_Total = 'Table'[Avg_CCWH] + 'Table'[Avg_ATACC]

    Result is as below.

    For further details,please find attachment.
    From your description, I noticed that your Target8 and the previous Target has some similarities.
    Please correct me if I misunderstood your needs.

     

    Best Regards,
    Yulia Yan

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

  • syaiful_fcpc's avatar
    syaiful_fcpc
    2 years ago

    Thanks for solution