0

Below is my table.

GName Year Opening Stock InQty initemvaluee Opening Stock Value Average Value Average Value previous
Bahria Town 2,016 4,454 126,610,300 - 28,426
Bahria Town 2,017 868 6,379 166,903,972 - 23,031 28,426

in average i am using formula

Average Value =
VAR foropning =
    IF (
        [Opening Stock] = 0,
        ( ( [initemvaluee] ) / ( [inqtyy] + [Opening Stock] ) )
    )
VAR notforopning =
    IF (
        [Opening Stock] <> 0,
        ( ( [initemvaluee] + [Opening Stock Value] ) / ( [inqtyy] + [Opening Stock] ) )
    )
RETURN
    IF ( [Opening Stock] = 0, foropning, notforopning )

for opening stock value i just simple doing

Opening Stock Value = [Opening Stock] * [Average Value previous] it gives error please help out of dependancy.

Alexis Olson
  • 38,724
  • 7
  • 42
  • 64

1 Answers1

0

I'm guessing your calculation for [Average Value previous] depends on [Average Value] which in turn depends on [Opening Stock Value] which loops right back around to depending on [Average Value previous].

Alexis Olson
  • 38,724
  • 7
  • 42
  • 64
  • Yes you right. i not getting how to get out this error. – Makhdoom Liaqat Sep 24 '21 at 21:23
  • It looks like you are trying to define your columns recursively. Unfortunately, DAX isn't well-suited for this but there might be workarounds. See here for a bit more detail: https://stackoverflow.com/questions/67809941 – Alexis Olson Sep 24 '21 at 21:29
  • I am just taking the average from 2 field initem value and then average of them for calulcating the out stock value for that year. and when it is new year then i have to forward that balance that's why i am forwarding the closing balance into next field which is closing balance of last yeear. Which will become opening balance for current year. – Makhdoom Liaqat Sep 24 '21 at 21:35