Forum Discussion

dbatllevz's avatar
dbatllevz
Frequent Visitor
3 years ago

Avoid circular dependency and wrong total measure

Dear all

 

I have a table (A) with actual inventory days and sales forecast. In another table (table B) I have max and min inventory days, both tables are related by a common key)

I tried to create 3 new columns in table A to have sales over max and under min and in range with very basic formulas:

Column 1 - Sales under Min= if(actuals<min, sales forecast,0)

Column 2 - Sales over Max= if(actuals>max, sales forecast,0)

Column 3 - In range= sales forecast-(min+max)

 

Column 1 is ok, issue is that when I try to create the other 2 in table A as appears a circular dependency

Therefore, to avoid this, I tried to create columns 2 and 3 with a measure (using the same formula)

But it seems that column 2 is working for row calculation but not in the grand total. It is calculating based on total for the column and not for each row:

As you can see, when in a row Actuals>Max it returns sales forecast
But, in the totals is caclulating 1918>1023=sales forecast, or in the case that is actuals<max then returns 0 as condition is not true

I understand that the measure is not wrong as somehow is doing what i wrote in DAX, but I would like to know how I can fix this to have in the grand total the sum of all rows and not the calculation based on totals

Many thanks in advance for the support

 

No RepliesBe the first to reply