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

Compete to become Power BI Data Viz World Champion! First round ends August 18th. Get started.

Reply
tushar479
New Member

Need help with circular dependency in power bi

Hello, I am trying to replicate excel formulaes for Base and Running total in Power BI using measures, but, i am getting circular dependency error

 

SEQ_NONEW_GROUP_INDRECOMMEND_INDTotal_RequestedBASE%_OF_REQUESTBASE_ALLOCPARTIAL_COUNTRUNNING_PARTIAL_COUNTRUNNING_TOTALBASE_BUDGETTotal Base
111 $                      100,000900000.990000009000098000090000
201 $                                 60,000540000.9540000014400098000054000
301 $                                 60,000540000.9540000019800098000054000
401 $                               100,000900000.9900000028800098000090000
501 $                                 60,000540000.9540000034200098000054000
601 $                               100,000900000.9900000043200098000090000
701 $                               100,000900000.9900000052200098000090000
801 $                                 65,000585000.9585000058050098000058500
901 $                                 69,500625500.9625500064305098000062550
1001 $                                 60,000540000.9540000069705098000054000
1101 $                               100,000900000.9900000078705098000090000
1201 $                                 76,21268590.80.9685900085564098000068590
1301 $                                 60,000540000.9540000090964098000054000
1401 $                                 60,000540000.9540000096364098000054000
1501 $                                 60,000163600.2726666670119636409800000

 

Below are the formulaes:

 

Base =IF([RECOMMEND_IND]=1,IF(NEW_GROUP_IND=1,IF(([Total_Requested]*[Selected_value_in_Parameter])<=[BASE_BUDGET],([Total_Requested]*[Selected_value_in_Parameter]),[BASE_BUDGET]),IF([RUNNING_TOTAL(previous row value)]+([Total_Requested]*[Selected_value_in_Parameter])<=[BASE_BUDGET (previous value)],([Total_Requested]*[Selected_value_in_Parameter]),[BASE_BUDGET]-[RUNNING_TOTAL(previous row value)])),0)

 

Running_Total = IF(NEW_GROUP_IND=1,[BASE_ALLOC],[RUNNING_TOTAL(previous row value)]+[BASE_ALLOC])

 

BASE_ALLOC = FLOOR(IF(NEW_GROUP_IND=1,IF([%_OF_REQUEST]>=[Selected_value_in_Parameter],Base,0),IF([RUNNING_PARTIAL_COUNT(Previous row value)]=0,IF([%_OF_REQUEST]>=[Selected_value_in_Parameter],Base,0),0)),10)

 

[%_OF_REQUEST] =IF(Base>0,Base/Total_Requested,0)

 

PARTIAL_COUNT =IF([%_OF_REQUEST]>0,IF([%_OF_REQUEST]<[Selected_value_in_Parameter],1,0),0)

 

RUNNING_PARTIAL_COUNT =IF(NEW_GROUP_IND=1,PARTIAL_COUNT,[RUNNING_TOTAL(previous row value)]+PARTIAL_COUNT)

 

 

 

 

 

 

 

3 REPLIES 3
raishubham955
New Member

To resolve this issue use CALCULATE + FILTER to fetch previous row values dynamically. Instead of direct recursion, SUMX, CALCULATE, and variables can help in creating sequential calculations.


 

  • Base Calculation:

    • If it's a new group, allocate either the requested amount or available budget.
    • If not a new group, use the previous running total to determine allocation.
  • Running Total:

    • Start fresh for new groups.
    • Add the previous row’s Running Total and the current Base Alloc.
  • Base Allocation:

    • If the % of Request meets the threshold, allocate the Base amount.
    • Use FLOOR() to round to the nearest 10.
  • % of Request Calculation:

    • If Base is greater than zero, divide by Total Requested.
  • Partial Count:

    • Mark as 1 if % of Request is below the selected threshold.
  • Running Partial Count:

    • Start fresh for a new group; otherwise, add previous row’s count.

 

Anonymous
Not applicable

Hi @tushar479 

 

If I understand correctly, you now need to calculate Base, Running_Total, BASE_ALLOC, [%_OF_REQUEST], PARTIAL_COUNT, RUNNING_PARTIAL_COUNT and expect the results to be as shown in the corresponding columns in the table? 

 

If so, according to my observation, you used [RUNNING_TOTAL(previous row value)] in the Base formula, and [BASE_ALLOC] in the Running_Total formula, then you used Base in the BASE_ALLOC formula. The formulas depend on each other, which should be the reason for the error. Just like in the following test, Measure2 was used in Measure, and Measure2 was used in Measure, so an error occurred.

vxuxinyimsft_0-1738300115206.png

 

vxuxinyimsft_1-1738300136592.png

 

In order to help you better, first I need to confirm with you which columns are already in the original data? Which column is used by [Selected_value_in_Parameter]? Could you please tell me what effect you want to achieve with Power BI?

 

Best Regards,
Yulia Xu

 

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

Hello,

yes, that's correct. I want to calculate the above mentioned formulaes in PowerBI.

 

I have created a filter "[Selected_value_in_Parameter]" that has values 1-100 which is used in the formulaes calculation.

 

The below values are static and present in the table already.

SEQ_NO, NEW_GROUP_IND, RECOMMEND_IND, Total_Requested

 

 

 

Helpful resources

Announcements
August Power BI Update Carousel

Power BI Monthly Update - August 2025

Check out the August 2025 Power BI update to learn about new features.

August 2025 community update carousel

Fabric Community Update - August 2025

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

Top Solution Authors