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
PBIFX200
New Member

Respecting filter context Issues, please Help!

Hello Everyone,

 

I think I'm having filter context issues! any help or hints would be very much appreciated!

 

I have this table called Ranking_New_Employee

Team or IANETranking for seniorityTotalNet to total
Adam329New Employee250213%
Jessica236New Employee87927%
Ben181New Employee110516%
Mark 164New Employee90518%
Dumanowski145New Employee28435%
Ewing116New Employee85414%
Vooys104New Employee29704%
Donahue82New Employee9129%
Mazigi70New Employee45116%
Gonzalez66New Employee27924%
Sherwick63New Employee16494%
Blaine48New Employee10225%
Andrew45New Employee22720%
Cordel40New Employee17112%
Garry38New Employee8524%
Pelleter31New Employee13052%
Catherine30New Employee10083%
Dan27New Employee3737%
Reid24New Employee18213%
Scott19New Employee11616%
Christian15New Employee10201%
Colin10New Employee2364%
Steven3New Employee9930%

 

I have created this measure to be able to get top 10/bottom10 by Net value.

 

TOP_New_emp =

VAR raking_asc =

    RANKX (

        ALL ( 'Ranking_New employee'[NET], 'Ranking_New employee'[Team or IA]),

        CALCULATE ( SUM ( 'Ranking_New employee'[NET] ) )

    )

VAR ranking_desc =

    RANKX (

        ALL ( 'Ranking_New employee'[NET], 'Ranking_New employee'[Team or IA]),

        CALCULATE ( SUM ( 'Ranking_New employee'[NET] ) ),

        ,ASC

    )

RETURN

    SWITCH (

        SELECTEDVALUE ( View_New_Employee[Type] ),

        "Bottom 10", IF ( ranking_desc <= 10, SUM ('Ranking_New employee'[NET] ),blank()),

        "Top 10", IF ( raking_asc <= 10, SUM ( 'Ranking_New employee'[NET]) , blank()

    ))

 

This is the result I get when I select top 10. but, of course, when I select bottom10, only the bottom 10 get selected.

 

unnamed (3).png

Team or IATop_New_emp
Adam329
Jessica236
Ben181
Mark 164
Dumanowski145
Ewing116
Vooys104
Donahue82
Mazigi70
Gonzalez66

 

*****The Issue starts here*****

 

Now, I have created this measure to get a % Net to total

 

unnamed (2).png

 

but when I drag this measure to the result above, I get this :

 

Team or IATop_New_empNet to total
Adam32913%
Jessica23627%
Ben18116%
Mark 16418%
Dumanowski1455%
Ewing11614%
Vooys1044%
Donahue829%
Mazigi7016%
Gonzalez6624%
Sherwick 4%
Blaine 5%
Andrew 20%
Cordel 2%
Garry 4%
Pelleter 2%
Catherine 3%
Dan 7%
Reid 13%
Scott 16%
Christian 1%
Colin 4%
Steven 0%

 

 

But, this is the desired result :

 

Team or IATop_New_empNet to total
Adam32913%
Jessica23627%
Ben18116%
Mark 16418%
Dumanowski1455%
Ewing11614%
Vooys1044%
Donahue829%
Mazigi7016%
Gonzalez6624%

 

I would like the new calculated measure to respect Top_New_emp filter. In other words, I want to get only Net to Total values that correspond to Top_New_emp whether I select Top 10 or Bottom 10.

 

For example,  when I select Top 10, I don't want the underlined values (refer to the table above) to appear.

 

Thanks in advance

1 REPLY 1
daxer-almighty
Solution Sage
Solution Sage

Well, you see only 10 of them not because of any filtering of the underlying table but because the measure returns BLANK for the rest of them. Just use this fact and modify the other measure to also be sensitive to what's been selected in the slicer. That's easier than you think. Add an IF to the measure and display a value only when the first measure, Top_new_emp, is non-blank.

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.

Top Solution Authors