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

July 7 - July 17 | Round 2 of the Power BI Dataviz World Championships. Don't miss your chance! Learn more

Reply
Anonymous
Not applicable

Topn error

Hi,

Can Anyone help,

Why my TOPN not filting the value, Its showing below error 

The expression refers to multiple columns. Multiple columns cannot be converted to a scalar value.

Sudhakar1000_0-1729841448769.png

 

 

11 REPLIES 11
Anonymous
Not applicable

Hi Raju,

Now its working Fine otherthen TOPN.

Test for TOP =
--Var _SV=SELECTEDVALUE(SBUTarget[SBUName])
Var _Tp=TOPN(3,ALLSELECTED('2425'[Customer Name]),'2425'[Achv_Val])
RETURN
CALCULATE('2425'[Achv_Val],
--FILTER('2425','2425'[Achv_Val]>10))
KEEPFILTERS(
FILTER('2425',
'2425'[Achv_Val]>10 && '2425'[SBUName]= "AI & ML" ||
 '2425'[Achv_Val]>5 && '2425'[SBUName]= "AV" ||
  '2425'[Achv_Val]>5 && '2425'[SBUName]= "Cloud" ||
   '2425'[Achv_Val]>5 && '2425'[SBUName]= "PCS" ||
    '2425'[Achv_Val]>5 && '2425'[SBUName]= "ECS" ||
     '2425'[Achv_Val]>5 && '2425'[SBUName]= "ESS" ||
      '2425'[Achv_Val]>5 && '2425'[SBUName]= "NWA" ||
       '2425'[Achv_Val]>5 && '2425'[SBUName]= "SCS" ||
       '2425'[Achv_Val]>5 && '2425'[SBUName]= "PWR" ||
        '2425'[Achv_Val]>5 && '2425'[SBUName]= "SERVICE" ||
        '2425'[Achv_Val]>5 && '2425'[SBUName]= "IMS" ||
        '2425'[Achv_Val]>5 && '2425'[SBUName]= "PS"
)
--'2425Rag'[SBUName]=_SV
))
 
Sudhakar1000_0-1730095312287.png

 

FreemanZ
Super User
Super User

hi @Anonymous ,

 

TOPN returns a table, you can't CALCULATE a table directly. What do you plan to do with the top3 table?

Anonymous
Not applicable

Hi Freeman,

i am trying to get top 3 customer from the given table based on condition 

rajendraongole1
Super User
Super User

Hi @Anonymous - can you try below measure

Test for TOP =
TOPN(3,
FILTER('2425', '2425'[SBUName]="AI & ML"),
'2425'[ValuesinLakhs],
DESC
)

 

Hope it works





Did I answer your question? Mark my post as a solution!

Proud to be a Super User!





Anonymous
Not applicable

Hi Raju,

Its says same error..

Sudhakar1000_0-1729842723216.png

 

Hi @Anonymous - can you try below updated with sumx

 

Test for TOP =
TOPN(
3,
FILTER('2425', '2425'[SBUName] = "AI & ML"),
SUMX('2425', '2425'[ValuesinLakhs]),
DESC
)





Did I answer your question? Mark my post as a solution!

Proud to be a Super User!





Anonymous
Not applicable

No Luck Raju.

Sudhakar1000_0-1729843359862.png

 

Hi @Anonymous -pls use below measure

 

Test for TOP =
CALCULATE(
    SUMX(
        TOPN(
            3,
            FILTER('Tableinfo', 'Tableinfo'[SBUName] = "AI & ML"),
            'Tableinfo'[ValuesinLakhs],
            DESC
        ),
        'Tableinfo'[ValuesinLakhs]
    )
)
 
working for me

 

rajendraongole1_0-1729845979076.png

 





Did I answer your question? Mark my post as a solution!

Proud to be a Super User!





Anonymous
Not applicable

Hi Raju,

TOPN function not filtering also total value calculattion showing wrong values

 

Sudhakar1000_0-1730090368466.png

 

hi @Anonymous ,

 

this shall already work. could you paste a link for your sample file?

Anonymous
Not applicable

Helpful resources

Announcements
FabCon and SQLCon Barcelona 2026

FabCon & SQLCon – Barcelona 2026

Join us in Barcelona for FabCon and SQLCon, the Fabric, Power BI, SQL, and AI community event. Save €200 with code FABCMTY200.

Fabric Community Sticker Design Challenge Barcelona Carousel

Fabric Community Sticker Challenge - Barcelona 2026

If you love stickers, then you will definitely want to check out our community sticker challenge, Barcelona edition!

July Power BI Update Carousel

Power BI Monthly Update - July 2026

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

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.

Top Solution Authors