Forum Discussion

charmainer's avatar
charmainer
Icon for Helper III rankHelper III
9 years ago

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

 dataresult

 

 

 

 

 

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

  • CahabaData's avatar
    CahabaData
    Icon for Memorable Member rankMemorable 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.....

     

     

    • charmainer's avatar
      charmainer
      Icon for Helper III rankHelper III

       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

       

      • erik_tarnvik's avatar
        erik_tarnvik
        Icon for Solution Specialist rankSolution Specialist

        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.