Join us at FabCon Atlanta from March 16 - 20, 2026, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.
Register now!To celebrate FabCon Vienna, we are offering 50% off select exams. Ends October 3rd. Request your discount now.
I have a table that holds a list of employees. In one of my measures I want to get the employee name using the maxx function. As far as efficiency, is it better to save the the employee table in a variable first, then access the table from within the same measure, or is it better to access the employee table without using a variable? Thanks.
@amitchandak In a row context, if the measure has a variable that contains the table, does every row query for that table and store it in memory for every row, or does BI just run query once and store it in memory, and each row calls this variable?
If it only runs the query once, then I assume it would be more efficient to store the table in a variable versus just straight query the table for every row?
Here is the code:
=================================================
Assigned Employee=
VAR Employee_Table =
SUMMARIZE(EmployeeTable, EmployeeTable[employeename])
VAR EmployeeReplacement_Table =
FILTER(
SUMMARIZE(EmployeePlacementTable,
EmployeePlacementTable[employeeReplacement],
EmployeePlacementTable[replacementName],
EmployeePlacementTable[dateofReplacement],
EmployeePlacementTable[leaverequestNumber]
),
DATEVALUE(EmployeeReplacement_Table[dateofReplacement]) = DATEVALUE([Today Date])
)
VAR WhoisWorkingToday=
IF([Employee Working Status] = "Working", MAXX(Employee_Table, Employee_Table[employeename]),
IF([Employee Working Status] = "Not Working", MAXX(FILTER(EmployeeReplacement_Table, EmployeeReplacement_Table[leaverequestNumber] = [Get LeaveRequest Number]), EmployeeReplacement_Table[replacementName])))
return WhoisWorkingToday
==========================================
Is it a good idea to place the employeeTable inside a variable or is it better to access the employeeTable directly?