Forum Discussion

jwesle's avatar
jwesle
Frequent Visitor
7 years ago
Solved

Calculating Completion Percent Based on Multiple Date Fields

Hello,

 

I will do my best to explain what I am trying to calculate. My data set will look something like the following:

 

Line Enter DateLine Data DateLine Complete Date
4/5/20194/5/20194/9/2019
4/7/20194/8/20194/12/2019
4/8/2019 4/10/2019
4/8/20194/9/2019 
4/10/20194/10/2019 
4/10/20194/10/2019 
4/12/20194/14/20194/14/2019
4/14/2019  
4/14/20194/14/2019 

 

I am trying to calculate the percentage of Open Lines that contain data (where Open Line is defined as an entered line with no Complete Date).

 

The table below represents the logic for this sample data and the desired result in the far right column:

 

Calendar DateNew Lines EnteredNew Data EnteredLines CompletedLines with Data CompletedTotal Open LinesTotal Open Lines with DataData Percentage
4/5/2019110011100%
4/6/2019000011100%
4/7/201910002150%
4/8/201921004250%
4/9/201901113267%
4/10/2019221044100%
4/11/2019000044100%
4/12/201910114375%
4/13/201900004375%
4/14/201922115480%

 

On 4/5, 1 line was entered with data, so the completion is (1/1) = 100%. 

No new data on 4/6 and no lines completed, so it remains (1/1) = 100%

One new line on 4/7 (but data not entered until 4/8), and no lines completed, so it reduces to (1/2) = 50%

On 4/8, two new lines entered with no data, but data entered on a previous open line, so it is (2/4) = 50%

On 4/9, no lines entered, data entered for one open line, and one line with data completes, so it is (2/3) = 67%

etc.

 

I am really struggling with the logic to build this concept in PowerBI. Any help/advice is greatly appreciated.

 

Thanks!

  • Hi jwesle 

     

    You can create columns to meet your demand.

     

    Total Open Lines = CALCULATE(SUM(Table1[New Lines Entered]),FILTER(Table1,Table1[Calendar Date]<=EARLIER(Table1[Calendar Date])))-CALCULATE(SUM(Table1[Lines Completed]),FILTER(Table1,Table1[Calendar Date]<=EARLIER(Table1[Calendar Date])))

     

    Total Open Lines with Data = CALCULATE(SUM(Table1[New Data Entered]),FILTER(Table1,Table1[Calendar Date]<=EARLIER(Table1[Calendar Date])))-CALCULATE(SUM(Table1[Lines with Data Completed]),FILTER(Table1,Table1[Calendar Date]<=EARLIER(Table1[Calendar Date])))

     

    Data Percentage = DIVIDE(Table1[Total Open Lines with Data],Table1[Total Open Lines])

     

     

     

     

     

     

    Here is my test pbix: https://qiuyunus-my.sharepoint.com/:u:/g/personal/pbipro_qiuyunus_onmicrosoft_com/EUjge7rleNZCme1QkqZxfIYBpPSvFnHIRSiOrvkyukwbMQ?e=EdFK6i

     

    Best Regards,

    Amy

     

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

1 Reply

  • v-xicai's avatar
    v-xicai
    Community Support

    Hi jwesle 

     

    You can create columns to meet your demand.

     

    Total Open Lines = CALCULATE(SUM(Table1[New Lines Entered]),FILTER(Table1,Table1[Calendar Date]<=EARLIER(Table1[Calendar Date])))-CALCULATE(SUM(Table1[Lines Completed]),FILTER(Table1,Table1[Calendar Date]<=EARLIER(Table1[Calendar Date])))

     

    Total Open Lines with Data = CALCULATE(SUM(Table1[New Data Entered]),FILTER(Table1,Table1[Calendar Date]<=EARLIER(Table1[Calendar Date])))-CALCULATE(SUM(Table1[Lines with Data Completed]),FILTER(Table1,Table1[Calendar Date]<=EARLIER(Table1[Calendar Date])))

     

    Data Percentage = DIVIDE(Table1[Total Open Lines with Data],Table1[Total Open Lines])

     

     

     

     

     

     

    Here is my test pbix: https://qiuyunus-my.sharepoint.com/:u:/g/personal/pbipro_qiuyunus_onmicrosoft_com/EUjge7rleNZCme1QkqZxfIYBpPSvFnHIRSiOrvkyukwbMQ?e=EdFK6i

     

    Best Regards,

    Amy

     

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