Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Score big with last-minute savings on the final tickets to FabCon Vienna. Secure your discount

Reply
RickBickens
Helper I
Helper I

Adding/Calculating Columns in a Table created with a Measure

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. 

RickBickens_0-1663776603462.png

Any help/suggestions are greatly appreciated.

1 ACCEPTED SOLUTION
RickBickens
Helper I
Helper I

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.

View solution in original post

1 REPLY 1
RickBickens
Helper I
Helper I

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.

Helpful resources

Announcements
August Power BI Update Carousel

Power BI Monthly Update - August 2025

Check out the August 2025 Power BI update to learn about new features.

August 2025 community update carousel

Fabric Community Update - August 2025

Find out what's new and trending in the Fabric community.