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

Get Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Learn more

Reply
floralau
New Member

Top N error: The expression refers to multiple columns.

Hi all,
 
I am new to power bi and faced some difficulties.

What's wrong with my following code?
 
measure =
TOPN(
3,
'Succesful Rate',
'Succesful Rate'[Channel],0
)
 
The error message is: The expression refers to multiple columns. Multiple columns cannot be converted to a scalar value.
 
 
Also, what i would like to do is to find out the number of different strings in "Channel".
"Channel" contains "aaa","aaa","aaa","bbb","bbb","ccc","ddd","ddd" etc.
 
Thanks for your help!
1 ACCEPTED SOLUTION
PhilipTreacy
Super User
Super User

Hi @floralau 

 

Download example PBIX file with the following code

 

TOPN returns a table which is why you are getting the error about 'multiple columns'.  I guess you are trying to create a measure, but a measure must be a single value, it can't hold a table.

 

To count the number of different strings use this measure

 

Number of Diff Strings = DISTINCTCOUNT('Successful Rate'[Channel])

 

 

floralau.png

Regards

 

Phil



Did I answer your question? Then please mark my post as the solution.
If I helped you, click on the Thumbs Up to give Kudos.


Blog :: YouTube Channel :: Connect on Linkedin


Proud to be a Super User!


View solution in original post

2 REPLIES 2
PhilipTreacy
Super User
Super User

Hi @floralau 

 

Download example PBIX file with the following code

 

TOPN returns a table which is why you are getting the error about 'multiple columns'.  I guess you are trying to create a measure, but a measure must be a single value, it can't hold a table.

 

To count the number of different strings use this measure

 

Number of Diff Strings = DISTINCTCOUNT('Successful Rate'[Channel])

 

 

floralau.png

Regards

 

Phil



Did I answer your question? Then please mark my post as the solution.
If I helped you, click on the Thumbs Up to give Kudos.


Blog :: YouTube Channel :: Connect on Linkedin


Proud to be a Super User!


Thanks so much for your help!

Helpful resources

Announcements
Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

October Power BI Update Carousel

Power BI Monthly Update - October 2025

Check out the October 2025 Power BI update to learn about new features.

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.

Top Solution Authors