Power BI is turning 10, and we’re marking the occasion with a special community challenge. Use your creativity to tell a story, uncover trends, or highlight something unexpected.
Get startedJoin us for an expert-led overview of the tools and concepts you'll need to become a Certified Power BI Data Analyst and pass exam PL-300. Register now.
Hi,
I am trying to optimize a DAX measures. I have following measure (just added partial - only the virtual table section) where I could see "Context transition in iterator" problem and I was trying to avoid but not able to do.
VAR tab1 =
ADDCOLUMNS (
SUMMARIZE (
ALLSELECTED ( 'FT' ),
'FT'[C1_RGN],
'FT'[C2_RGN_RTLR],
'FT'[B1_VALUE],
'FT'[S1_VALUE],
'FT'[PCK],
'FT'[C_PACKS]
),
"y", ( [test])
)
and
test = CALCULATE (
SUM ( 'FT'[Y_AMT] ),
ALLSELECTED (
'FT'[PCK_VALUE],
'FT'[S1_VALUE],
'FT'[S2_VALUE],
'FT'[B1_VALUE],
'FT'[S1_VALUE],
'FT'[LCL_PCK],
'FT'[C_PACKS]
)
Here "y" is referring another measure which has different context and scope. How to avoid Context transition in iterator in this case?
Solved! Go to Solution.
Try using variables to store the results before the context transition occurs.
VAR testValue =
CALCULATE (
SUM ( 'FT'[Y_AMT] ),
ALLSELECTED (
'FT'[PCK_VALUE],
'FT'[S1_VALUE],
'FT'[S2_VALUE],
'FT'[B1_VALUE],
'FT'[S1_VALUE],
'FT'[LCL_PCK],
'FT'[C_PACKS] ))
VAR tab1 =
ADDCOLUMNS (
SUMMARIZE (
ALLSELECTED ( 'FT' ),
'FT'[C1_RGN],
'FT'[C2_RGN_RTLR],
'FT'[B1_VALUE],
'FT'[S1_VALUE],
'FT'[PCK],
'FT'[C_PACKS]),
"y", testValue)
If you have any questions or need more info, just hit me up!
Try using variables to store the results before the context transition occurs.
VAR testValue =
CALCULATE (
SUM ( 'FT'[Y_AMT] ),
ALLSELECTED (
'FT'[PCK_VALUE],
'FT'[S1_VALUE],
'FT'[S2_VALUE],
'FT'[B1_VALUE],
'FT'[S1_VALUE],
'FT'[LCL_PCK],
'FT'[C_PACKS] ))
VAR tab1 =
ADDCOLUMNS (
SUMMARIZE (
ALLSELECTED ( 'FT' ),
'FT'[C1_RGN],
'FT'[C2_RGN_RTLR],
'FT'[B1_VALUE],
'FT'[S1_VALUE],
'FT'[PCK],
'FT'[C_PACKS]),
"y", testValue)
If you have any questions or need more info, just hit me up!
This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.
Check out the June 2025 Power BI update to learn about new features.
User | Count |
---|---|
11 | |
9 | |
8 | |
8 | |
7 |
User | Count |
---|---|
14 | |
12 | |
11 | |
10 | |
9 |