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

Earn a 50% discount on the DP-600 certification exam by completing the Fabric 30 Days to Learn It challenge.

Reply
ArT101
Helper I
Helper I

Stop recalculation of matrix table when filtering the table to show topN values

I'm trying to get my matrix table to show these values:

Screenshot 2022-11-24 185104.png

 

 

when I filter the table to show the the top 1st name it filters the value to:

 

Screenshot 2022-11-24 185023.png

1 ACCEPTED SOLUTION
ArT101
Helper I
Helper I

https://goodly.co.in/top-n-and-others-power-bi/

 

I used the following blog to help me with my problem. Had to tweak the code a lil to match the measures I calculated but it works as expected.

View solution in original post

8 REPLIES 8
ArT101
Helper I
Helper I

https://goodly.co.in/top-n-and-others-power-bi/

 

I used the following blog to help me with my problem. Had to tweak the code a lil to match the measures I calculated but it works as expected.

Ashish_Mathur
Super User
Super User

Hi,

Share the download link of your PBI file.


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/

Screenshot 2022-11-25 140701.png

Hopefully this screenshot will suffice for you.

Hi,

Do away with the Over hits measure.  Revise the % measure to

=divide([Measure test],[Hit])

Hope this helps.


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/

No it still recalculate the percentage to 100%

Screenshot 2022-11-26 102048.png

I want the percentage to stay the way it was before the table was filtered

 

Screenshot 2022-11-26 102021.png

Hi,

Share the download link of the PBI file.


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/
v-yangliu-msft
Community Support
Community Support

Hi  @ArT101 ,

I created some data:

vyangliumsft_0-1669341299039.png

Here are the steps you can follow:

1. Create calculated table.

Sum =
 var _table=SUMMARIZE('Table','Table'[Name],
 "Sum",SUMX(FILTER(ALL('Table'),'Table'[Name]=EARLIER('Table'[Name])),[Amount]))
return
ADDCOLUMNS(
    _table,"Rank",RANKX(_table,[Sum],,DESC))

vyangliumsft_1-1669341299042.png

2. Create measure.

Measure test =
SUMX(FILTER(ALL('Table'),'Table'[Name]=MAX('Table'[Name])),[Amount])
Overalll Hits =
SUMX(ALL('Table'),[Amount])
% =
DIVIDE(
    [Measure test],[Overalll Hits])
rank =
MAXX(FILTER(ALL('Sum'),'Sum'[Name]=MAX('Table'[Name])),[Rank])
Flag =
IF(
    [rank]=1,1,0)

Before filtering:

vyangliumsft_2-1669341299043.png

3. Place [Flag]in Filters, set is=1, apply filter.

vyangliumsft_3-1669341299043.png

4. Result:

After filtering:

vyangliumsft_4-1669341299046.png

 

Best Regards,

Liu Yang

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

Thank you greatly for the help. My only issue is the summing of the amounts. I am aware that my first message was vague with the explanation because I thought the process would be much simpler then the method you provided.

 

So for more information. My table is basically showing the number of times a match has been made against specific names provided by a user, which is what is showing in the name column. Even though multiple names can be duplicated, their Id's make them unique. So while I do want to be able to know what the values of the name A adds up to, I still want to keep them as individual row values. Like the image shows:

Screenshot 2022-11-25 033552.png

 

This is my code used:

 

Measure test = SUMX(VALUES(Table name'[Column name]), CALCULATE(DISTINCTCOUNT('Table name'[Column name]), 'Table name'[Column name] <> BLANK()))
 
Then for the overall hits, I created a measure counting the overall matches made within the table.I wanted to use the total of this measure to divide for my % so I used this code:
 
Overall hits = CALCULATE([Measure], ALLSELECTED())
 
Then that's how I created my %: Measure Test/Overall hits.
 
The overall hits changes depending on the date filter. So the value isn't constant.
 
Hopefully this makes sense.

Helpful resources

Announcements
RTI Forums Carousel3

New forum boards available in Real-Time Intelligence.

Ask questions in Eventhouse and KQL, Eventstream, and Reflex.

LearnSurvey

Fabric certifications survey

Certification feedback opportunity for the community.