Supplies are limited. Contact info@espc.tech right away to save your spot before the conference sells out.
Get your discountScore big with last-minute savings on the final tickets to FabCon Vienna. Secure your discount
Hi there,
I am working on trying to create a table within a measure, which has multiple columns which are subsequently calculated within the measure and am having trouble within the generated table referencing the other columns for calculations.
The reason I am building a table within a measure to perform these calculations is some depend on values passed from measures and I want the calculations to be dynamic. I built the calculations in calculated columns previously but those do not recalculate/adjust when the parameters are changed.
My formula for the measure is:
Measure First Shift Util =
var table1 = ADDCOLUMNS(
SUMMARIZE(Order_Data,Order_Data[FIXED_DATE], "Lines", COUNTROWS(Order_Data)),
"Hours_Required", [Lines] / 'SummarizedDays'[Design Lines per Hour],
"Shifts_Required", CEILING([Hours_Required]/'HoursPerShift'[HoursPerShift Value],'HoursPerShift'[HoursPerShift Value]),
"First_Shift_Utilization", If([Shifts_Required] = 1, [Lines]/(HoursPerShift[HoursPerShift Value]*[Design Lines per Hour]),1))
return AVERAGEX(table1,[First_Shift_Utilization])
Currently I am able to reference [Lines] within the measure but the references to the [Hours_Required], [Shifts_Required], and [First_Shift_Utilization] cannot be found or may not be used in this expression.
Any help/suggestions are greatly appreciated.
Solved! Go to Solution.
I figured out that the measure can't reference the columns while they are being created in that format.
In order to build the table I was trying to create in the measure, and have the subsequent columns calculate with values present in the other columns, I needed to do the following:
Measure First Shift Util =
var table1 = ADDCOLUMNS(ADDCOLUMNS(ADDCOLUMNS(SUMMARIZE(Order_Data,Order_Data[FIXED_DATE], "Lines", COUNTROWS(Order_Data)), "Hours_Required", [Lines] / 'SummarizedDays'[Design Lines per Hour]), "Shifts_Required", CEILING([Hours_Required]/'HoursPerShift'[HoursPerShift Value],'HoursPerShift'[HoursPerShift Value])),"First_Shift_Utilization", If([Shifts_Required] = 1, [Lines]/(HoursPerShift[HoursPerShift Value]*[Design Lines per Hour]),1))
return AVERAGEX(table1,[First_Shift_Utilization])
This allowed the columns to be added one-by-one and then the columns could reference other columns addde in earlier ADDCOLUMNS() operations.
I figured out that the measure can't reference the columns while they are being created in that format.
In order to build the table I was trying to create in the measure, and have the subsequent columns calculate with values present in the other columns, I needed to do the following:
Measure First Shift Util =
var table1 = ADDCOLUMNS(ADDCOLUMNS(ADDCOLUMNS(SUMMARIZE(Order_Data,Order_Data[FIXED_DATE], "Lines", COUNTROWS(Order_Data)), "Hours_Required", [Lines] / 'SummarizedDays'[Design Lines per Hour]), "Shifts_Required", CEILING([Hours_Required]/'HoursPerShift'[HoursPerShift Value],'HoursPerShift'[HoursPerShift Value])),"First_Shift_Utilization", If([Shifts_Required] = 1, [Lines]/(HoursPerShift[HoursPerShift Value]*[Design Lines per Hour]),1))
return AVERAGEX(table1,[First_Shift_Utilization])
This allowed the columns to be added one-by-one and then the columns could reference other columns addde in earlier ADDCOLUMNS() operations.