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

Earn the coveted Fabric Analytics Engineer certification. 100% off your exam for a limited time only!

Reply
Anonymous
Not applicable

Select N top using dax

Hi,

I need  help,

 

I have table with name Student, I want to show student data in table report and give the user option to re retrive the number of rows depended on the studend mark, such as if the user need to show top 3 , the report resulte contain only to three student

if the user enter 5 the report resulte contain only to five student .... and any value the user enter based on it the # of rows return

 

Regards,

 

 

 

t3.PNG

6 REPLIES 6
TomMartens
Super User
Super User

Hey,

 

here you will find a pbix file

 

The file contains sample data for the columns "Name", "Gender", "Nationality", and "Mark".

I addition to the sample data I created a what-if parameter (https://docs.microsoft.com/en-us/power-bi/desktop-what-if)

I created two measures. The 1st measure "rnk Student by Mark" ranks the students by the value of the column "Mark" and a 2nd measure that checks if the selected parameter value (representing the user interaction) is larger or equal to the rank of the student, if this is the case, the measure returns 1. This measure is used as a visual filter.

 

The measure "rnk Student by Mark"

rnk Student by Mark = 
RANKX(
    ALL(Students)
    ,CALCULATE(MAX('Students'[Mark]))
    ,
    ,DESC
)

The 2nd measure "rnk and Parameter" that I use as toggle in the visual filter section of the table

rnk and Parameter = 
IF(SELECTEDVALUE('Top N Numbers'[Top N Numbers])>=[rnk Student by Mark], 1,0)

And a screenshot of the report page

2018-04-01_16-32-34.png

 

Hope this is what you are looking for

 

Regards

Tom



Did I answer your question? Mark my post as a solution, this will help others!

Proud to be a Super User!
I accept Kudos 😉
Hamburg, Germany
Anonymous
Not applicable

Hey Tom,

 

Thanks very much for  you reply,

I tried to trace your steps but no any thing change and not fix with metest.PNG

kinfilterrrrrr.PNGsort.PNG 

 

and I try to import pbiix file but Ican't, please tell me how I can Import it here

 

Regards

Hey,

 

to assist you any further, please upload your pbix file to onedrive or dropbox and share the link.

 

Are there any messages if you try to import my pbix file. Please be aware that I'm always using the latest PBI Desktop version 🙂

 

Regards

Tom



Did I answer your question? Mark my post as a solution, this will help others!

Proud to be a Super User!
I accept Kudos 😉
Hamburg, Germany
Anonymous
Not applicable

thanks Tom,

 

 

I  share pbix file  here,   the  report  inside page 1 ,kindly trace what is  the error with me and thanks advanve 

Regards 

 

 

Mohammed

Anonymous
Not applicable

Hi,

I need  help,

 

I have table with name Student, I want to show student data in table report and give the user option to re retrive the number of rows depended on the studend mark, such as if the user need to show top 3 , the report resulte contain only to three student

if the user enter 5 the report resulte contain only to five student .... and any value the user enter based on it the # of rows return

 

Regards,

 

 

 

t3.PNG

Hey,

 

as far as I can see this is a duplicate question.

 

Look here for my answer, you may consider to delete this question

 

Regards

Tom



Did I answer your question? Mark my post as a solution, this will help others!

Proud to be a Super User!
I accept Kudos 😉
Hamburg, Germany

Helpful resources

Announcements
April AMA free

Microsoft Fabric AMA Livestream

Join us Tuesday, April 09, 9:00 – 10:00 AM PST for a live, expert-led Q&A session on all things Microsoft Fabric!

March Fabric Community Update

Fabric Community Update - March 2024

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