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

Enhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.

Reply
Anonymous
Not applicable

Passing in Selected Value DAX function into the TOPN Function

Hi PBI,

 

I have a requirement to pass in Selected Value (Slicer Selection) into the TOPN function into the TOPN function.This is a Sample Format in which my Data isisThis is a Sample Format in which my Data isis

The Filter Selection from where the user would make a Selection (Single Select will be enabled)The Filter Selection from where the user would make a Selection (Single Select will be enabled)

Problem: 

The User would be Selecting a Week in the Above Filter. Once The user make a Selection in the Above Filter I would need to pass it into a Summarize Function which is encapsulated over a TOPN function. Basically the Output thats expected is for me to have the TOP 10 Channels based on Views for the Selected Week.

 

Expressions that is resolving

 

TOPN(SUMMARIZE(FILTER(TABLE, TABLE[Year&Week]= "2019w23", TABLE[CHANNEL],"SUM Views", SUM(Views) ),[SUM Views], DESC)

 

Expressions that I am using which is not resolving the Calculated Table for Top 10 Channels for the Selected Week

 

TOPN(SUMMARIZE(FILTER(TABLE, TABLE[Year&Week]= SELECTEDVALUE(YEAR&WEEK[Year&Week])), TABLE[CHANNEL],"SUM Views", SUM(Views) ),[SUM Views], DESC)

 

Output Expected:

If the User Selects the Week as 2019W23 , then this is the Output Expected.If the User Selects the Week as 2019W23 , then this is the Output Expected.

 

PS. I am open to any method that would resolve the Top 10 Channels for a Selected Week.

 

 

1 ACCEPTED SOLUTION
Anonymous
Not applicable

The table/matrix visual in PBI lets you show only TOPN items based on a measure... and a DAX measure cannot return a table, it can only return a value.

 

TOPN as Visual level filter.PNG

 

By the way, please read upon the SUMMARIZE function because clearly, you're completely unaware of the traps that it presents. Go to www.sqlbi.com and look for SUMMARIZE.

 

Best

Darek

View solution in original post

1 REPLY 1
Anonymous
Not applicable

The table/matrix visual in PBI lets you show only TOPN items based on a measure... and a DAX measure cannot return a table, it can only return a value.

 

TOPN as Visual level filter.PNG

 

By the way, please read upon the SUMMARIZE function because clearly, you're completely unaware of the traps that it presents. Go to www.sqlbi.com and look for SUMMARIZE.

 

Best

Darek

Helpful resources

Announcements
July 2025 community update carousel

Fabric Community Update - July 2025

Find out what's new and trending in the Fabric community.

July PBI25 Carousel

Power BI Monthly Update - July 2025

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

Join our Fabric User Panel

Join our Fabric User Panel

This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.