Forum Discussion

swarnikasinha's avatar
2 years ago
Solved

Ranking

 

 

Hi All

 

I am looking for resolution!

 

I have a report where row level security is applied on the report. Report is integrated to power apps.

Now every user will login in powerapps portal and will see his data.

 

There is one graph where I need to show top 5 suppliers for buyers. If I put top 5 in power BI report data is filtered for top 5 Suppliers.Now when we push this report in powerapps every buyer is able to see his data but for ‘top five suppliers graph’ data is blank. This is Obvious because I already filtered the data in Power BI desktop and that buyer has no data for that supplier It will show Zero.

 

So I think I need a table like this :

Buyer Email

Supplier

[email protected]

EREY456

 

FGHJ678

 

FDCB678

 

SDCFGY8

 

WDH765

 

ROW

[email protected]

CDF789M

 

CDFRE4567

 

DVCMK987

 

SCXHD678

 

NFJFK890

 

ROW

This is Dummy data.

*ROW is Rest of Suppliers.

I am Ranking Suppliers for every Buyer on different column in same table.

 

 

 

Please assist.

 

Thanks

Swarnika

Gilbert Dhruvin 

  • Anonymous's avatar
    Anonymous
    2 years ago

    Hi swarnikasinha 

    You can use topn() function. you can refer to the following example.

    Sample data 

     

    1.Create a rank column 

     

    Rank = RANKX(FILTER('Table',[Column1]=EARLIER('Table'[Column1])),[Column2],,ASC)

     

    2.Then create a measure

     

    Measure = var a=SUMMARIZE(TOPN(5,FILTER(ALLSELECTED('Table'),[Column1] in VALUES('Table'[Column1])),[Column2],DESC),[Column2])
    return IF(SELECTEDVALUE('Table'[Column2]) in a,1,0)

     

    Then put the measure to the visual filter

     

    Output

    Best Regards!

    Yolo Zhu

    If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

     

     

1 Reply

  • Anonymous's avatar
    Anonymous
    Not applicable

    Hi swarnikasinha 

    You can use topn() function. you can refer to the following example.

    Sample data 

     

    1.Create a rank column 

     

    Rank = RANKX(FILTER('Table',[Column1]=EARLIER('Table'[Column1])),[Column2],,ASC)

     

    2.Then create a measure

     

    Measure = var a=SUMMARIZE(TOPN(5,FILTER(ALLSELECTED('Table'),[Column1] in VALUES('Table'[Column1])),[Column2],DESC),[Column2])
    return IF(SELECTEDVALUE('Table'[Column2]) in a,1,0)

     

    Then put the measure to the visual filter

     

    Output

    Best Regards!

    Yolo Zhu

    If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.