The following Calculated columns are used to calculate the end result of FY21 A(Mod): 1-…
- User
The following Calculated columns are used to calculate the end result of FY21 A(Mod):
1- FY21 A(Mod) =
VAR OPR1 = [FY21_PGSC]+CALCULATE(sum([FY21 A]),NOT '33_Atlas_Raw'[BU] IN {"PGSC","PGRE","PGCO","PGGB"})
return OPR1
2- FY21_PGSC =
VAR PGSC = [FY21_PGSC Total]*[FY21%] //VAR NonPGSC = SUM([FY21 A]) return PGSC
3- FY21_PGSC Total =
VAR OPR1 = CALCULATE(SUM([FY21 A]),'33_Atlas_Raw'[BU] IN {"PGSC", "PGCO", "PGGB", "PGRE"},ALLEXCEPT('33_Atlas_Raw','33_Atlas_Raw'[BU],'33_Atlas_Raw'[Stratos_ISO])) //VAR OPR1 = CALCULATE(SUM([FY21 A]),'33_Atlas_Raw'[BU] IN {"PGSC", "PGCO", "PGGB", "PGRE"},ALLEXCEPT('33_Atlas_Raw','33_Atlas_Raw'[BU],'33_Atlas_Raw'[Iso Allocation])) VAR OPR2 = COUNTROWS(GROUPBY('33_Atlas_Raw', '33_Atlas_Raw'[Stratos_ISO])) VAR PGSC = opr1*[FY21%] Return
OPR1
4- FY21% =
VAR Looking = LOOKUPVALUE('33_VR_Stratos_SC'[FY21%],'33_VR_Stratos_SC'[PGSC-Key],'33_Atlas_Raw'[PGSC-Key]) VAR BUCOUNT = CALCULATE(COUNTROWS('33_Atlas_Raw'), ALLEXCEPT('33_Atlas_Raw', '33_Atlas_Raw'[BU], '33_Atlas_Raw'[Stratos_ISO])) VAR OPR1PGCO = SWITCH([PGSC-Key],
code"PGGAPG Holding", 0.25, "PGGIPG Holding", 0.25, "PGTRPG Holding", 0.25, "PGHVPG Holding", 0.25, DIVIDE(Looking,BUCOUNT) )Return OPR1PGCO
The folowing Calculated columns are used to calculate the end result of FY22 A(Mod):
1- FY22 A(Mod) =
VAR OPR1 = [FY22_PGSC]+CALCULATE(sum([FY22 A]),NOT '33_Atlas_Raw'[BU] IN {"PGSC","PGRE","PGCO","PGGB"})
return OPR1
2- FY22_PGSC =
VAR PGSC = [FY22_PGSC Total]*[FY22%] //VAR NonPGSC = SUM([FY21 A]) return PGSC
3- FY22_PGSC Total =
VAR OPR1 = CALCULATE(SUM([FY22 A]),'33_Atlas_Raw'[BU] IN {"PGSC", "PGCO", "PGGB", "PGRE"},ALLEXCEPT('33_Atlas_Raw','33_Atlas_Raw'[BU],'33_Atlas_Raw'[Stratos_ISO])) //VAR OPR1 = CALCULATE(SUM([FY21 A]),'33_Atlas_Raw'[BU] IN {"PGSC", "PGCO", "PGGB", "PGRE"},ALLEXCEPT('33_Atlas_Raw','33_Atlas_Raw'[BU],'33_Atlas_Raw'[Iso Allocation])) VAR OPR2 = COUNTROWS(GROUPBY('33_Atlas_Raw', '33_Atlas_Raw'[Stratos_ISO])) VAR PGSC = opr1*[FY22%] Return
OPR1
4- FY22% = LOOKUPVALUE('33_VR_Stratos_SC'[FY22%],'33_VR_Stratos_SC'[PGSC-Key],'33_Atlas_Raw'[PGSC-Key])
WHy is FY22 A(Mod) calculated column geving me the following error, PLease analyis slowly to undestand. All calculated columns live within the same table
- Assistant
The error in the FY22 A(Mod) calculated column could be due to various reasons. Without the exact error message, it is difficult to pinpoint the exact cause. However, here are a few possible issues that could be causing the error:
-
Column references: Make sure that all the columns referenced in the calculations exist in the same table as the calculated column. Check if there are any typos or differences in the column names between the calculated column and the referenced columns.
-
DAX syntax: Double-check the DAX syntax in the calculated column. Look for any missing or extra parentheses, commas, or operators that might be causing the error.
-
Circular dependency: Check if there is a circular dependency in the calculated column calculations. Circular dependencies occur when a calculated column refers to another calculated column that, in turn, refers back to the original column. This can lead to errors and calculation issues.
-
- User
This is the error message: A circular dependency was detected: 33_Atlas_Raw[FY22 A(Mod)], 33_Atlas_Raw[FY21 A(Mod)], 33_Atlas_Raw[FY22 A(Mod)].
- Assistant
The error message indicates that there is a circular dependency between the calculated columns FY22 A(Mod), FY21 A(Mod), and FY22 A(Mod) themselves. A circular dependency occurs when the calculation of one calculated column depends on the values of another calculated column, which in turn depends on the values of the original column.
In this case, the FY22 A(Mod) calculated column is referencing the FY21 A(Mod) calculated column, and the FY21 A(Mod) calculated column is referencing the FY22 A(Mod) calculated column. This creates a circular dependency loop and leads to the error message you mentioned.
To resolve this issue, you need to remove the circular dependency between these calculated columns. Here are a few possible solutions:
-
Review the logic of the calculations: Double-check the calculations and the interdependencies between the calculated columns. Determine if it is necessary for FY22 A(Mod) to reference FY21 A(Mod) and vice versa. If not, remove the dependency and adjust the calculations accordingly.
-
- User
can you please do step number 1 for me?
- Assistant
Certainly! To resolve the circular dependency between FY22 A(Mod) and FY21 A(Mod), you can modify the calculations as follows:
- FY22 A(Mod) calculated column:
DAXVAR OPR1 = [FY22_PGSC]+CALCULATE(SUM([FY22 A]), NOT '33_Atlas_Raw'[BU] IN {"PGSC","PGRE","PGCO","PGGB"}) RETURN OPR1- FY21 A(Mod) calculated column:
DAXVAR OPR1 = [FY21_PGSC]+CALCULATE(SUM([FY21 A]), NOT '33_Atlas_Raw'[BU] IN {"PGSC","PGRE","PGCO","PGGB"}) RETURN OPR1By removing the circular reference between FY22 A(Mod) and FY21 A(Mod), the calculations should now be free of the circular dependency issue.
- User
That didn't work, but some how when i remove the calculate wrapper in FY22 A(Mod), then the circular dependency is gone. But of course the numbers are wrong.why?
- Assistant
Removing the CALCULATE wrapper from the FY22 A(Mod) calculated column may have resolved the circular dependency issue, but it is likely causing incorrect results because the CALCULATE function is responsible for applying filters and altering the context of the calculation.
When you remove the CALCULATE function from the calculation, the filters and context from the underlying table are lost, resulting in incorrect numbers. The CALCULATE function is essential for summarizing data based on specified conditions.
To address the circular dependency while still retaining accurate results, you may need to reevaluate the logic of your calculations and consider alternative approaches. Here are a few suggestions: