Forum Discussion

elponce's avatar
elponce
Frequent Visitor
8 years ago
Solved

Building a Percentage Table in Power BI

Hello!

 

I have the columns below (first Table) that I am trying to use to calculate a percentage of items completed "On-Time" per month and year by using the formula: # Items On-Time/ (# Items "On-Time" + "Late")*100. The second table shows what I am trying to accomplish here. Is it possible to do this in Power BI? Thank you in advanced!!

 

  • Hey,

     

    I would create a measure like so (please be aware that it is not tested, because I didn't recreate a table from your example):

    Compliance = 
    CALCULATE(
    count('table'[eventid])
    ,'table'[status] = "On-time"
    )
    /
    CALCULATE(
    count('table'[eventid]),
    ALL('table'[status])
    )

    Hopefully this provides the solution you are looking for.

     

    Regards

    Tom

     

3 Replies

  • Hey,

     

    I would create a measure like so (please be aware that it is not tested, because I didn't recreate a table from your example):

    Compliance = 
    CALCULATE(
    count('table'[eventid])
    ,'table'[status] = "On-time"
    )
    /
    CALCULATE(
    count('table'[eventid]),
    ALL('table'[status])
    )

    Hopefully this provides the solution you are looking for.

     

    Regards

    Tom

     

    • elponce's avatar
      elponce
      Frequent Visitor

      Thank you for your help! This works!

  • Hi,

     

    Try this.  In your Table visual, drag Year and Month in the Row labels.  Write this measure

     

    =CALCULATE(COUNTROWS(Data),Data[Enter Time Status]="On-Time")/COUNTROWS(Data)

     

    Hope this helps.