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!View all the Fabric Data Days sessions on demand. View schedule
Hi, I am not sure how to correct this formula, I always get the error note The CONTAINSROW function expects a table expression for argument '', but a string or numeric expression was used.
Solved! Go to Solution.
Hi @dkc
You cannot use a condition to return a table or table expression. While SelectedCustTable doesn't return an error using this in another expression will cause an error. Try this:
VAR SelectedCustTable01 =
VALUES ( 'Hierarchy level Slicer'[HIERARCHY_LEVEL] )
VAR SelectedCustTable02 =
ALL ( 'Hierarchy level Slicer'[HIERARCHY_LEVEL] )
VAR ThisCustomer =
MAX ( 'FACTS_C4C Promos'[Hierarchy Level] )
RETURN
IF (
ISFILTERED ( 'Hierarchy level Slicer'[HIERARCHY_LEVEL] ),
CALCULATE (
COUNTROWS ( 'DIM_Customer Master' ),
FILTER (
'DIM_Customer Master',
'DIM_Customer Master'[CUSTOMER_MASTER_DATA_HIERARCHY_LEVEL] = ThisCustomer
&& CONTAINSROW (
SelectedCustTable01,
'DIM_Customer Master'[CUSTOMER_MASTER_DATA_HIERARCHY_LEVEL]
)
)
),
CALCULATE (
COUNTROWS ( 'DIM_Customer Master' ),
FILTER (
'DIM_Customer Master',
'DIM_Customer Master'[CUSTOMER_MASTER_DATA_HIERARCHY_LEVEL] = ThisCustomer
&& CONTAINSROW (
SelectedCustTable02,
'DIM_Customer Master'[CUSTOMER_MASTER_DATA_HIERARCHY_LEVEL]
)
)
)
)
thank you, now it was working and I understood the logic
Hi @dkc
You cannot use a condition to return a table or table expression. While SelectedCustTable doesn't return an error using this in another expression will cause an error. Try this:
VAR SelectedCustTable01 =
VALUES ( 'Hierarchy level Slicer'[HIERARCHY_LEVEL] )
VAR SelectedCustTable02 =
ALL ( 'Hierarchy level Slicer'[HIERARCHY_LEVEL] )
VAR ThisCustomer =
MAX ( 'FACTS_C4C Promos'[Hierarchy Level] )
RETURN
IF (
ISFILTERED ( 'Hierarchy level Slicer'[HIERARCHY_LEVEL] ),
CALCULATE (
COUNTROWS ( 'DIM_Customer Master' ),
FILTER (
'DIM_Customer Master',
'DIM_Customer Master'[CUSTOMER_MASTER_DATA_HIERARCHY_LEVEL] = ThisCustomer
&& CONTAINSROW (
SelectedCustTable01,
'DIM_Customer Master'[CUSTOMER_MASTER_DATA_HIERARCHY_LEVEL]
)
)
),
CALCULATE (
COUNTROWS ( 'DIM_Customer Master' ),
FILTER (
'DIM_Customer Master',
'DIM_Customer Master'[CUSTOMER_MASTER_DATA_HIERARCHY_LEVEL] = ThisCustomer
&& CONTAINSROW (
SelectedCustTable02,
'DIM_Customer Master'[CUSTOMER_MASTER_DATA_HIERARCHY_LEVEL]
)
)
)
)
Hi,
Could you share some data, explain the question and share the expected result. Share data in a format that can be pasted in an MS Excel file.
Check out the November 2025 Power BI update to learn about new features.
Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!