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

Join the Fabric FabCon Global Hackathon—running virtually through Nov 3. Open to all skill levels. $10,000 in prizes! Register now.

Reply
Anonymous
Not applicable

ALLSELECTED INSIDE OF ALLEXCEPT?

ALLSELECTED inside of ALLEXCEPT is not possible.

Is there a workaround, using INTERSECT of EXCEPT?

 

In the table below, the last column is fine. It shows the total of each 'NL' line.

sachintandonpc_0-1601553050885.png

 

But, I want this column to respond to the selected filters on the User, P&L, Department, and Job Grade columns.

So if I do this:

sachintandonpc_1-1601553175775.png

 

 

The amount shown on the Salary line should be: 11,458, and not still 91,875

 

My current measure for this column is this:

 

Total Amount [GBP] Selected Persons:=

Total Amount Selected Persons :=
VAR FilteredTable =
CALCULATETABLE (
Payroll_Table,
ALLSELECTED ( Payroll_Table[User ID] ),
ALLSELECTED ( Payroll_Table[P&L] ),
ALLSELECTED ( Payroll_Table[Department] ),
ALLSELECTED ( Payroll_Table[Job Grade] )
)
RETURN
CALCULATE (
SUM ( [Amount] ),
ALLEXCEPT ( Payroll_Table, Payroll_Table[Date], Payroll_Table[NL Line] )
)

 

(ignore the variable for now)

 

Any ideas on how to achieve this?

 

 

 

 

1 ACCEPTED SOLUTION
Anonymous
Not applicable

Ok, I think I resolved it.

Because of the Table structure of the Pivot Table, I had to include the First, and Last Name fields, as well:

 

Total Amount Selected Persons :=
CALCULATE (
SUM ( [Amount] ),
ALLSELECTED ( Payroll_Table[User ID] ),
ALLSELECTED ( Payroll_Table[First Name] ),
ALLSELECTED ( Payroll_Table[Last Name] ),
ALLS ( Payroll_Table[P&L] ),
ALL ( Payroll_Table[Department] ),
ALL ( Payroll_Table[Job Grade] )
)

 

Results are now better.

sachintandonpc_0-1601557613240.png

 

View solution in original post

4 REPLIES 4
Anonymous
Not applicable

I also tried this, but it doesn't work:

 

CALCULATE (

SUM ( [Amount] ),

ALLEXCEPT ( Payroll_Table, Payroll_Table[Date], Payroll_Table[NL Line] ),

ALLSELECTED ( Payroll_Table[User ID] ),

ALLSELECTED ( Payroll_Table[P&L] ),

ALLSELECTED ( Payroll_Table[Department] ),

ALLSELECTED ( Payroll_Table[Job Grade] )

)

@Anonymous , try like

 

CALCULATE (
SUM ( [Amount] ),
filter (allselected( Payroll_Table), Payroll_Table[Date] =max(Payroll_Table[Date]) && Payroll_Table[NL Line] = max(Payroll_Table[NL Line]))
)

 

Payroll_Table is actual table not the car table you used in one formula

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube
Anonymous
Not applicable

Your measure doesn't work I'm afraid.

 

I get this, which is quite wrong

 

sachintandonpc_0-1601555699138.png

 

Anonymous
Not applicable

Ok, I think I resolved it.

Because of the Table structure of the Pivot Table, I had to include the First, and Last Name fields, as well:

 

Total Amount Selected Persons :=
CALCULATE (
SUM ( [Amount] ),
ALLSELECTED ( Payroll_Table[User ID] ),
ALLSELECTED ( Payroll_Table[First Name] ),
ALLSELECTED ( Payroll_Table[Last Name] ),
ALLS ( Payroll_Table[P&L] ),
ALL ( Payroll_Table[Department] ),
ALL ( Payroll_Table[Job Grade] )
)

 

Results are now better.

sachintandonpc_0-1601557613240.png

 

Helpful resources

Announcements
September Power BI Update Carousel

Power BI Monthly Update - September 2025

Check out the September 2025 Power BI update to learn about new features.

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.