Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
Anonymous
Not applicable

Utilization calculaton circular reference

Hello guys,

 

I have browsed the forum, but I believe I haven't really found what I'm searching for. The major trouble I have is with Circular referencing, since I want to calculate my resource utilization based on two other calculated columns. (See picture below)

 

Resource table.PNG

 

In this table I have columns "Resource" and "Start of use" , which are static. Column "Today's date" is based on formula done in PowerQuery(DateTime.LocalNow())). Column "Capacity (seconds)" and "Worktime total for Resource" formula are done in PowerBI desktop as a calculated column, with formula:

 

Capacity (seconds) = -DATEDIFF('Resource'[Today's date];'Resource'[Start of use];SECOND)
Worktime total for Resource = CALCULATE(SUM('Sheet1'[Worktime]); ALLSELECTED('Resource'[Resource]))
 
To get the utilization % per resource I would normally divide "Worktime total for Resource" with "Capacity (seconds)" and multiply it with 100.

When trying to do the aforementioned process I get a circular reference error. One of the posts suggested to convert the calculated columns to measurs and take it from there, but when I try to create a measure, I could only find additional measures for that table.
 
Any help towards achieving "Utilization %" column or measure, that would react to filtering would be appreciated.
1 ACCEPTED SOLUTION

Hi @Anonymous ,

Sorry for some latency, please refer to the following result:

PBIDesktop_e0sw7Fmrev.png

We can change the DAX query for Worktime total for Resource like below:

Worktime total for Resource = CALCULATE(SUM('Sheet1'[Worktime]), FILTER(ALL(Sheet1),Sheet1[Resource] = EARLIER(Resource[Resource])))

Then create the following calculated column:

Utilization % = DIVIDE(Resource[Worktime total for Resource],Resource[Capacity (seconds)]) * 100

Best Regards,

Teige

View solution in original post

6 REPLIES 6
TeigeGao
Solution Sage
Solution Sage

Hi @Anonymous ,

Your scenario is a common circular dependencies problem, you can try to change the following dax

Worktime total for Resource = CALCULATE(SUM('Sheet1'[Worktime]); ALLSELECTED('Resource'[Resource]))

to:

Worktime total for Resource = CALCULATE(SUM('Sheet1'[Worktime]), 'Sheet1'[**] = ALLSELECTED('Resource'[Resource]))

For more information, please refer to this blog: https://www.sqlbi.com/articles/avoiding-circular-dependency-errors-in-dax/

Best Regards,

Teige

Anonymous
Not applicable

Hi @TeigeGao 

 

Would you be able to look into the comment made in earlier post? For some reason I get an error, when trying to do Sheet1**

Hi @Anonymous ,

If you could share the pbix to me, I would get more information about this problem, it will help me troubleshoot it.

Best Regards,

Teige

Anonymous
Not applicable

@TeigeGaoI will share the file with you via direct message.

Hi @Anonymous ,

Sorry for some latency, please refer to the following result:

PBIDesktop_e0sw7Fmrev.png

We can change the DAX query for Worktime total for Resource like below:

Worktime total for Resource = CALCULATE(SUM('Sheet1'[Worktime]), FILTER(ALL(Sheet1),Sheet1[Resource] = EARLIER(Resource[Resource])))

Then create the following calculated column:

Utilization % = DIVIDE(Resource[Worktime total for Resource],Resource[Capacity (seconds)]) * 100

Best Regards,

Teige

Anonymous
Not applicable

Hi @TeigeGao 

 

I tried to change the formula to your suggested format, but for some reason I get an error.
 

"Column '**' in table 'Sheet1' cannot be found or may not be used in this expression."

What I understood from the formula is that I would try to selected all of the data (columns) in page Sheet1 and have it equal to Resource table column Resource.
I tried to modify the DAX to have it with 1 asteryx, '*', but that didn't work as well.

Do you have any idea, what might be the issue in this case?

Thanks

Ramirenter

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.