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

We've captured the moments from FabCon & SQLCon that everyone is talking about, and we are bringing them to the community, live and on-demand. Starts on April 14th. Register now

Reply
Anonymous
Not applicable

function expects table expression for argument '2', but a string or numeric expression...

I just need some tips on what to do that would work in this situation if I can't use an if statement.

 

I have the below column in Power BI Desktop which is creating the error, "the function expects a table expression for argument '2', but a string or numeric expression was used." How do I get around this?

 

Sales = if(PS_PP[Grp Desc] = ("Comm Acctble"),0,sum(PS_PP[Sales])-sum(PS_PP[LCT]) - sum(PS_PP[LCB]) - sum(PS_PP[LCH]))
1 ACCEPTED SOLUTION
d_gosbell
Super User
Super User

I can't see how you would be getting that error from that expression.

 

What table are you creating this column in and how is that table related to the PS_PP table? You obviously cannot be creating this column in the PS_PP table as you are attempting to call SUM(PS_PP[Sales]) and that would create a circular reference error not the "expects a table expression" error.

 

If you try a simple if like the following does that work?

 

Sales = if(PS_PP[Grp Desc] = "Comm Acctble" , 0, 1)

 

If so that would point to this issue coming from one of the SUM calls somehow.

View solution in original post

3 REPLIES 3
d_gosbell
Super User
Super User

I can't see how you would be getting that error from that expression.

 

What table are you creating this column in and how is that table related to the PS_PP table? You obviously cannot be creating this column in the PS_PP table as you are attempting to call SUM(PS_PP[Sales]) and that would create a circular reference error not the "expects a table expression" error.

 

If you try a simple if like the following does that work?

 

Sales = if(PS_PP[Grp Desc] = "Comm Acctble" , 0, 1)

 

If so that would point to this issue coming from one of the SUM calls somehow.

Anonymous
Not applicable

This is all in one table, I don't have any other tables. Your basic function worked so I tried taking out the SUM()s, which at first didn't work. I finally just tried rewriting the whole thing minus the sums into a new column and it worked! I'm not sure why it would only work in a new column...

OK, so if this is all in one table then you most likely don't want the SUM() functions in there as that will calculate the grand total for the column, which you probably don't want repeated in every row.

 

I'm not sure why the first column was have this issue, but I have once or twice seen error messages get "stuck", so deleting and re-creating the column like you did is probably the simplest work around.

Helpful resources

Announcements
New to Fabric survey Carousel

New to Fabric Survey

If you have recently started exploring Fabric, we'd love to hear how it's going. Your feedback can help with product improvements.

Power BI DataViz World Championships carousel

Power BI DataViz World Championships - June 2026

A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.

Join our Fabric User Panel

Join our Fabric User Panel

Share feedback directly with Fabric product managers, participate in targeted research studies and influence the Fabric roadmap.

March Power BI Update Carousel

Power BI Community Update - March 2026

Check out the March 2026 Power BI update to learn about new features.