Power BI is turning 10! Tune in for a special live episode on July 24 with behind-the-scenes stories, product evolution highlights, and a sneak peek at what’s in store for the future.
Save the dateEnhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.
Hello
I wants to create a measure based on a temporary table but despite all my effort I still have the same error
Table variable 'Rend' cannot be used in current context because a base table is expected.
The code is this one
Solved! Go to Solution.
You can't refer to columns from a variable by using the TableName[ColumnName] syntax, you have to just use [ColumnName]. Try
Measure2 =
VAR Rend =
ADDCOLUMNS (
SUMMARIZE ( control_result, control_result[campaign] ),
"comment",
CALCULATE (
DISTINCTCOUNTNOBLANK ( control_result[controlresultid] ),
control_result[approver_comment] < 10,
control_result[performer_comment] < 10
),
"orby", LOOKUPVALUE ( Campaign_Sort[Sort By], Campaign_Sort[Campaign], Rend[campaign] )
)
VAR numerateur =
SUMX (
Rend,
( [orby] - AVERAGEX ( Rend, [orby] ) )
* ( [comment] - AVERAGEX ( Rend, [comment] ) )
)
VAR Denominateur =
SUMX (
Rend,
( [orby] - AVERAGEX ( Rend, [orby] ) )
* ( [orby] - AVERAGEX ( Rend, [orby] ) )
)
RETURN
IF (
DIVIDE ( numerateur, Denominateur ) < 0,
"↓",
IF ( DIVIDE ( numerateur, Denominateur ) > 0, "↑", "→" )
)
Thank you it works
You can't refer to columns from a variable by using the TableName[ColumnName] syntax, you have to just use [ColumnName]. Try
Measure2 =
VAR Rend =
ADDCOLUMNS (
SUMMARIZE ( control_result, control_result[campaign] ),
"comment",
CALCULATE (
DISTINCTCOUNTNOBLANK ( control_result[controlresultid] ),
control_result[approver_comment] < 10,
control_result[performer_comment] < 10
),
"orby", LOOKUPVALUE ( Campaign_Sort[Sort By], Campaign_Sort[Campaign], Rend[campaign] )
)
VAR numerateur =
SUMX (
Rend,
( [orby] - AVERAGEX ( Rend, [orby] ) )
* ( [comment] - AVERAGEX ( Rend, [comment] ) )
)
VAR Denominateur =
SUMX (
Rend,
( [orby] - AVERAGEX ( Rend, [orby] ) )
* ( [orby] - AVERAGEX ( Rend, [orby] ) )
)
RETURN
IF (
DIVIDE ( numerateur, Denominateur ) < 0,
"↓",
IF ( DIVIDE ( numerateur, Denominateur ) > 0, "↑", "→" )
)
Check out the July 2025 Power BI update to learn about new features.
This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.
User | Count |
---|---|
17 | |
7 | |
7 | |
6 | |
5 |
User | Count |
---|---|
22 | |
10 | |
10 | |
9 | |
7 |