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

multiple rank columns in matrix table

Hi all, I would need to have an extra rank column for each criteria that is selected in the criteria filter.

Is that possible

Many thanks

David

 

 

 

2020-10-09_16-00-21.png

1 ACCEPTED SOLUTION

Accepted Solutions
Highlighted

Hi @ADP007 ,

 

We can create a calculate column and a measure to meet your requirement.

 

1. Create a rank column.

 

AVG. RANK = 
RANKX(
    FILTER(
        mScoreData,
        [CATEGORY]=EARLIER([CATEGORY])
        &&[CRITERIA]=EARLIER([CRITERIA])
        ),
        mScoreData[SCORE],,DESC,Dense)

 

mul1.jpg

 

2. Then create an average measure.

 

AVGRank = 
var _total = 
CALCULATE(
    SUM(mScoreData[AVG. RANK]),
    FILTER(
        ALLSELECTED(mScoreData),
        [CATEGORY]=MAX([CATEGORY])
        &&[CATEGORY2]=MAX([CATEGORY2])
        &&[MEDIA]=MAX([MEDIA])
        &&[LABEL]=MAX([LABEL])))
var _count = CALCULATE(DISTINCTCOUNT(mScoreData[CRITERIA]),ALLSELECTED(mScoreData))
return
DIVIDE(_total,_count)

 

mul2.jpg

 

If you have any question, please kindly ask here and we will try to resolve it.

 

Best regards,

 

Community Support Team _ zhenbw

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

 

BTW, pbix as attached.

View solution in original post

10 REPLIES 10
Highlighted
Super User IV
Super User IV

@ADP007 , Not very clear. You can not add a column when the filter is applied, You can change Rank calculation based on.

 

 

Please provide your feedback comments and advice for new videos
Tutorial Series Dax Vs SQL Direct Query PBI Tips
Appreciate your Kudos.



Did I answer your question? Mark my post as a solution! Appreciate your Kudos!!
Dashboard of My Blogs !! YouTube Channel !! Connect on Linkedin

Proud to be a Super User!

Highlighted

@amitchandak, thanks for your time. When I select items from the criteria filter the dimension gets added to the matrix. 

In my image I have 4 criterias selected and thus 4 columns in my matrix table. I would like to have an extra column in the matrix for each dimension with the ranking. Something like this but of course dynamically. Hope this helps.

 

CATEGORYSECTORBRANDMEDIAConvincingRankDraws attentionRankInspiringRankLikeabilityRank
Highlighted

Hi @ADP007 ,

 

We can create a measure and put it in Values to meet your requirement.

 

 

Rank =
RANKX (
    FILTER ( ALLSELECTED ( 'Table' ), 'Table'[Media] = MAX ( 'Table'[Media] ) ),
    CALCULATE ( SUM ( 'Table'[value] ) ),
    ,
    ASC,
    DENSE
)

 

 

mul1.jpg

 

If it doesn’t meet your requirement, could you please provide a mockup sample based on fake data?

It will be helpful if you can show us the exact expected result based on the tables.

 

Please upload your files to OneDrive For Business and share the link here. Please don't contain any Confidential Information or Real data in your reply.

 

Best regards,

 

Community Support Team _ zhenbw

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

 

BTW, pbix as attached.

Highlighted

Hi, On holiday this week but will try and give an answer as soon as possible.

Thanks

Highlighted

Hi, Here is the link, hope it works : mScore 

 

There is an xls file with what I'm trying to obtain.

 

Thanks for any help

 

David

 

Highlighted

hi @v-zhenbw-msft 

 

I have managed to place a rank column following your mockup. However I'm still stuck as I need to calculate a new column based on the various rank columns. In the image below I would need an order by which is the average rank for on line. For example line 1 would have an order by of 5.4 (6+6+4+6+5)/5. Is this possible? 

2020-10-19_14-20-48.png

Highlighted

Hi @ADP007 ,

 

We can create a calculate column and a measure to meet your requirement.

 

1. Create a rank column.

 

AVG. RANK = 
RANKX(
    FILTER(
        mScoreData,
        [CATEGORY]=EARLIER([CATEGORY])
        &&[CRITERIA]=EARLIER([CRITERIA])
        ),
        mScoreData[SCORE],,DESC,Dense)

 

mul1.jpg

 

2. Then create an average measure.

 

AVGRank = 
var _total = 
CALCULATE(
    SUM(mScoreData[AVG. RANK]),
    FILTER(
        ALLSELECTED(mScoreData),
        [CATEGORY]=MAX([CATEGORY])
        &&[CATEGORY2]=MAX([CATEGORY2])
        &&[MEDIA]=MAX([MEDIA])
        &&[LABEL]=MAX([LABEL])))
var _count = CALCULATE(DISTINCTCOUNT(mScoreData[CRITERIA]),ALLSELECTED(mScoreData))
return
DIVIDE(_total,_count)

 

mul2.jpg

 

If you have any question, please kindly ask here and we will try to resolve it.

 

Best regards,

 

Community Support Team _ zhenbw

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

 

BTW, pbix as attached.

View solution in original post

Highlighted

hi @v-zhenbw-msft 

 

So many thanks for your help, I don't use Power Bi enough or often enough.

 

I have three remarks:

  1. The Rank columns seems not to be correct (there are several rows with the value 1)
  2. Is it possible to have the average as a dimension so that it is possible to apply a sort on it? 
  3. The average rank doesn't seem to be correct when you filter on media/brand/sector

Thanks

 

 

2020-10-20_12-59-56.png

Highlighted

hi @v-zhenbw-msft 

I understand why the rank was not correct. The matrix needs to be fully expanded for the rank to work.

So the only thing I need is to have this avr rang as a column. The reason is for the user to sort asc or desc on this value.

Thanks

D.

 

2020-10-21_08-48-18.png

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

Top Solution Authors
Top Kudoed Authors