Forum Discussion

A-Aron's avatar
A-Aron
Icon for Helper I rankHelper I
4 years ago
Solved

Efficiency percentage from multiple criteria.

Hello friends i hope i can explain this clearly, 

I have the sample table below that logs work records from multiple combined tables. Each location has hours worked and a potential of hours that i have specified. I need to create a way to calculate an efficiency percentage that filters by site. There are multiple entries per date per site so i need to figure out how to count the multiple days filtered by site then divide the potential hours which is specified by the count of each day. For example; Brim have a total of 12.5 possible hours per day. They logged 3 entries for Date 1/1 for a total of 4 hours. Im trying to get potential hours column to count the amount of entries for date 1/1 then divide 12.5 by how many the count of date is to get 4.1 in each row so i can use for a filter.   

 

DateLocationHours workedPotential hours 
1/1Brim2

VAR BR = COUNTROWS(date)

=IF(Location='Brim', BR/12.5) IF(Location='Neo', BR/17)

IF(Location='Vic', BR/14)

1/1Brim1 
1/1Brim1 
1/1Neo2 
1/1Neo4 
1/1Neo1 
1/1Vic3 
1/1Vic1 
1/1Vic2 

 

  • Hi A-Aron ,

     

    Please new a calculated column:

    Potential hours = 
    VAR _countrows =
        CALCULATE (
            COUNTROWS ( 'Table' ),
            FILTER (
                'Table',
                'Table'[Date] = EARLIER ( 'Table'[Date] )
                    && 'Table'[Location] = EARLIER ( 'Table'[Location] )
            )
        )
    VAR _result = 
    SWITCH(
        'Table'[Location],
        "Brim",DIVIDE(12.5,_countrows),
        "Neo",DIVIDE(17,_countrows),
        "Vic",DIVIDE(14,_countrows)
    )
    RETURN
        _result

    The PBIX file is attached for reference.

    PBIX file 

     

    Best Regards,
    changqing

9 Replies

  • SpartaBI's avatar
    SpartaBI
    Icon for Community Champion rankCommunity Champion

    A-Aron is this the result you want to get?

    VAR BR = COUNTROWS(date)

    =IF(Location='Brim', BR/12.5) IF(Location='Neo', BR/17)

    IF(Location='Vic', BR/14)

    What is this code? or it's just a logic?

    • A-Aron's avatar
      A-Aron
      Icon for Helper I rankHelper I

      its code that i have tried but doesnt work. 

      • SpartaBI's avatar
        SpartaBI
        Icon for Community Champion rankCommunity Champion

        A-Aron can you hard code the results for that column? Didn't fully understand what you want to get.
        Also, do you want to this as a calculated column or as a measure to put in table visuals?