A family of Microsoft spreadsheet software with tools for analyzing, charting, and communicating data.
Hello RichardDrake1505,
* I am a Microsoft user like you, providing solutions to community members; I am NOT a Microsoft employee.
The reason your formula breaks when using INDIRECT inside VSTACK twice is because LAMBDA captures the value of s and c at the time the function is defined, not when it's called within REDUCE.
Here's how you can fix it:
Option 1: Use INDEX Instead of INDIRECT Instead of INDIRECT, use INDEX to reference the elements within Table13[Store]. This approach relies on the actual positions of s and c within the table:
REDUCE(TAKE(Table13[Store],1), DROP(Table13[Store],1), LAMBDA(s,c, VSTACK(INDEX(Table13[Store], s), INDEX(Table13[Store], c))))
Option 2: Use a Nested LAMBDA You can use a nested LAMBDA function within your main LAMBDA to access the current values of s and c during each iteration of REDUCE:
REDUCE(TAKE(Table13[Store],1), DROP(Table13[Store],1),
LAMBDA(s,c,
VSTACK(
LAMBDA(x, INDIRECT(x)) (s),
LAMBDA(x, INDIRECT(x)) (c)
)
)
)
Hope this helps.
- Stephen N.