cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Frequent Visitor

Summarize error with The express refers to multiple columns.

Hi,

 

I am trying to build a table of EMP headcounts based of their Hours working group,. The dataset is like;

 

Job                                      EMP Names                                        Total

Civil                                     James                                                  200

Civil                                    Paul                                                      2000

Pipe                                    Paul                                                      4000

Pipe                                    Troy                                                     700

Market                               Tom                                                      500

 

I have;

  • Table: Append1
  • Column 1: Append1[JOB] 
  • Column 2: Append1[Employee Name]
  • Column 3: Append1[Total]  - Actual work hours

And below is the folmula that I am using;

 

Experience Table = summarize(Append1,Append1[JOB],Append1[Employee Name],"0 to 250",Calculate(distinctcount(Append1[Employee Name]),Filter(Append1,Append1[Total]<=250)),"500 to 1000",Calculate(distinctcount(Append1[Employee Name]),Filter(Append1,And(Append1[Total]>250,Append1[Total]<=500))),"1000 to 2000",Calculate(distinctcount(Append1[Employee Name]),Filter(Append1, And(Append1[Total]>1000,Append1[Total]<=2000))),"2000 to 4000",Calculate(distinctcount(Append1[Employee Name]),Filter(Append1, And(Append1[Total]>2000,Append1[Total]<=4000))),"Over 4000",Calculate(distinctcount(Append1[Employee Name]),Filter(Append1,Append1[Total]>4000)))
 
 
And my end result that I want is;
 
JOB                 >250     250 to 500     500 to 1000      1000 to 2000      2000 to 4000       >4000
Civil                    1               0                    0                        1                          0                      0
Pipe                    0               0                    1                        0                          1                      0
Market                0              1                      0                      0                          0                      0
 
 
 
I am trying to find out why it comes up with error; "The expression refers to multiple columns. Multiple columns cannot be converted to a scalar value.
 
Pleas help.
 
Thank you,

 

2 ACCEPTED SOLUTIONS
Super User IV
Super User IV

@nhan1 

If you are not doing any aggregation on Append1[Total].

Create a new column in the append table and use it?

Bucket =

Switch(true(),
Append1[Total]<=250,"0 to 250",
Append1[Total]<=500,"250 to 550",
Append1[Total]<=1000,"500 to 1000",
Append1[Total]<=2000,"1000 to 2000",
Append1[Total]<=2000,"2000 to 4000",
"Over 4000"
)



Did I answer your question? Mark my post as a solution! Appreciate your Kudos!!
Dashboard of My Blogs !! YouTube Channel !! Connect on Linkedin

Proud to be a Super User!

View solution in original post

Community Support
Community Support

@nhan1 

 

You need to Create a calculated table not column or measure.

 

Community Support Team _ Sam Zha
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

2 REPLIES 2
Community Support
Community Support

@nhan1 

 

You need to Create a calculated table not column or measure.

 

Community Support Team _ Sam Zha
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

Super User IV
Super User IV

@nhan1 

If you are not doing any aggregation on Append1[Total].

Create a new column in the append table and use it?

Bucket =

Switch(true(),
Append1[Total]<=250,"0 to 250",
Append1[Total]<=500,"250 to 550",
Append1[Total]<=1000,"500 to 1000",
Append1[Total]<=2000,"1000 to 2000",
Append1[Total]<=2000,"2000 to 4000",
"Over 4000"
)



Did I answer your question? Mark my post as a solution! Appreciate your Kudos!!
Dashboard of My Blogs !! YouTube Channel !! Connect on Linkedin

Proud to be a Super User!

View solution in original post

Helpful resources

Announcements
secondImage

Congratulations!

We are excited to announce the Power BI Super Users!

Wave Release 2

Check out the updates in Power BI.

Overview of Power BI 2020 release wave 2!

Get Ready for Power BI Dev Camp

Get Ready for Power BI Dev Camp

Mark your calendars and join us for our next Power BI Dev Camp!.

secondImage

The largest Power BI virtual conference

100+ sessions, 100+ speakers, Product managers, MVPs, and experts. All about Power BI. Attend online or watch the recordings.

Top Solution Authors
Top Kudoed Authors