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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
charmainer
Helper III
Helper III

Top 3 values in a row in Table

I am looking at a way to represent the top 3 valsue in a row.

Currently data in SQL database 2016 : On premises

 

is there a way in PowerBi to reperesent to 3 value in a row?

in my example i want

 

to list the top  3 salesmen - based on how much of a product they have sold. ( rank along side)

 

image 1 shows  data

 datadataresultresult

 

 

 

 

 

image 2 show result data.

Request any suggestions on represnting the top 3 vallues for each row of Data in Power BI.

 

Thanks and Kind Regards

Charmaine

 

 

5 REPLIES 5
CahabaData
Memorable Member
Memorable Member

the answer is fundamentally yes - there is a TopN and a Rank function in DAX and also in visual filtering and so there is more than 1 way to construct this.

 

In your raw data you show product values side-by-side while in your goal they are stacked.  And so there is an unpivot task to perform.

 

It wasn't quite clear as to whether you sought top 3 sales person or top 3 product  - - or maybe both.....

 

 

www.CahabaData.com

 Thanks  for your reply.

 I need the Top 3 Products sold for every sales  Person.

 

I do not know dax too well though so any suggestions would help.

 

Kind Regards,

Charmaine

 

My advise would be to use the Query Editor to reshape the data in a format that makes it much easier to achieve your objective. Instead of:

 

Name             Product 1          Product 2
Salesman 1       200                300
Salesman 2       20                 450

 

 

you would want:

 

Name            Product           Amount
Salesman 1      Product 1         200
Salesman 1 Product 2 300
Salesman 2 Product 1 20
Salesman 2 Product 2 450

 

You can use "Unpivot Column" functionality in the Query editor to achieve this. Once you have the data in this format you can use the DAX TOPN function.

 

Hi Thanks for that.

I have tried to unpivot ... but i have duplicate values in the real data ( i have just given you a sample) .

Will get back to you with what i have come back with. i might change the real data and upload it to see how to over come the dupliecat values.

 

Kind Regards

 

Charmaine

Hi,

Back to my top 3 with new version of Matrix

i have upgraded to the new version of BI desktop (sep 2017). 

With better sample data,

 

I have used the latest matrix feature which allows to show columns as rows.

attached pic.

sample.png

 

The final list is i want the above to only list the TOP 3 vlaues and Ranks per student( as for each student only list the underlined)

in the Matrix above or

 

 

listed like below

Studnet ID Ranked 1Ranked 2Ranked 3
567 Judgement Rank Honesty Rank Humanity Rank
566Leadership RankHumor RankFairness Rank

 

Any suggestions ?

 

 

 

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

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