Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
4 years ago
Solved

Circular dependencies how to solve?

Hello, Can anyone help me

how to solve circular dependency!

I am creating the below column measure and I am getting the same error-
 
Sum of hours per employee test = CALCULATE( SUM(table[total_hours]),GROUPBY(table,table[employee_id]))



 
  • Hi Anonymous ,

     

    This column measure is seems that you want to calculate each employee total work hours, is it?

     

    if yes please consider using the following expression:

     

    Sum of hours per employee test =
    CALCULATE(
        SUM( 'table'[total_hours] ),
        FILTER( 'table', [employee_id] = EARLIER( 'table'[employee_id] ) )
    )
    

     

     

    If this does not work, please provide some example data without sensitive data.

     


    Best Regards

    Community Support Team _ chenwu zhu

     

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

2 Replies

  • Anonymous's avatar
    Anonymous
    Not applicable

    Your GROUPBY is being used in the FILTER position for CALCULATE.  Are you trying to create a table of total hours by employee?

     

    If so, try this instead:

    NewTable=SUMMARIZECOLUMNS('table'[employee_id],'table',"TotalHours",SUM('table'[total_hours]))
  • v-chenwuz-msft's avatar
    v-chenwuz-msft
    Icon for Community Support rankCommunity Support

    Hi Anonymous ,

     

    This column measure is seems that you want to calculate each employee total work hours, is it?

     

    if yes please consider using the following expression:

     

    Sum of hours per employee test =
    CALCULATE(
        SUM( 'table'[total_hours] ),
        FILTER( 'table', [employee_id] = EARLIER( 'table'[employee_id] ) )
    )
    

     

     

    If this does not work, please provide some example data without sensitive data.

     


    Best Regards

    Community Support Team _ chenwu zhu

     

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