cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
Helper IV
Helper IV

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
Highlighted
Helper IV
Helper IV

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

Highlighted
Super User II
Super User II

Re: Select N top using dax

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
Highlighted
Super User II
Super User II

Re: Select N top using DAX

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
Highlighted
Helper IV
Helper IV

Re: Select N top using dax

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

Highlighted
Super User II
Super User II

Re: Select N top using dax

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
Highlighted
Helper IV
Helper IV

Re: Select N top using dax

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

Helpful resources

Announcements
Community Conference

Power Platform Community Conference

Check out the on demand sessions that are available now!

Community Conference

Microsoft Power Platform Communities

Check out the Winners!

secondImage

Power Platform 2020 release wave 2 plan

Features releasing from October 2020 through March 2021

Tech Marathon

Maratón de Soluciones de Negocio Microsoft

Una semana de contenido con +100 sesiones educativas, consultorios, +10 workshops Premium, Hackaton, EXPO, Networking Hall y mucho más!

Top Solution Authors
Top Kudoed Authors
Users online (781)