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

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! 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
Power BI DataViz World Championships

Power BI Dataviz World Championships

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!

December 2025 Power BI Update Carousel

Power BI Monthly Update - December 2025

Check out the December 2025 Power BI Holiday Recap!

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.