Alternative to 'all' that shows only 'selected' items

btreg

New Member
Joined
Feb 29, 2016
Messages
30
I am using the following measure in my model:

=maxx(all(Russell_Group[Provider short name]),[Student FTE (Total)])-[Student FTE (Total)]

I have the 'Providers' as rows in my pivot table and the purpose is to show the difference in Student FTE between each provider and top-ranked provider.

My problem is that the 'all' function within the 'maxx' calculation is causing all providers to be included in my pivot table, even those that don't have any Student FTEs, which makes it look a mess.

Is there an alternative to 'all' that would only return the providers that already appear on the pivot table based on existing filters (i.e. ~ 'selected' providers).

Hope this makes sense! Many thanks in advance.
 

Excel Facts

Remove leading & trailing spaces
Save as CSV to remove all leading and trailing spaces. It is faster than using TRIM().
Hi btreg,

The problem (as you have described) is that MAXX(ALL(...),...) returns a value regardless of filter context.

The simplest method I can think of is to check if the current value of [Student FTE (Total)] is blank:

1. If you are using a version of DAX without variables:
Code:
=
IF (
    NOT ( ISBLANK ( [Student FTE (Total)] ) ),
    MAXX ( ALL ( Russell_Group[Provider short name] ), [Student FTE (Total)] )
        - [Student FTE (Total)]
)

2. If your version of DAX includes variables then you can use this version (to avoid repeated calculation):
Code:
=
VAR StudentFTECurrentValue = [Student FTE (Total)]
RETURN
    IF (
        NOT ( ISBLANK ( StudentFTECurrentValue ) ),
        MAXX ( ALL ( Russell_Group[Provider short name] ), [Student FTE (Total)] )
            - StudentFTECurrentValue
    )
 
Upvote 0
Hi Owen,

I used 'option 1' and it gives me exactly the result I need - thanks a million for your help!

Ben
 
Upvote 0

Forum statistics

Threads
1,215,356
Messages
6,124,475
Members
449,164
Latest member
Monchichi

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top