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
wad11656
Advocate I
Advocate I

ALLSELECTED: Selecting the *wrong* column filter gives the *correct* result? (in CALCULATE function)

This formula gives the following result:

Furniture Total = CALCULATE([OPC Total], ALLSELECTED('MyTable'[OPC]))

wad11656_1-1663109697265.png

Furniture Total = Add line items with matching Company names:

Company1: $32,494,925.41 + $44,115,186.84 = $76,610,112.25

Company2: $2,907,016.22 + $4,261,988.05 = $7,169,004.27

Company3: $14,796,661.94 + $16,265,809.15 = $31,062,471.09

 

However, isn't this formula wrong?

 

Why is it adding line items with matching Company names? I ALLSELECTED the OPC column in my filter, so shouldn't it be adding line items with maching OPC names?

 

Oddly (to me), when I ALLSELECTED the *Company* column in my filter, it adds values with matching OPC names!:

Furniture Total = CALCULATE([OPC Total], ALLSELECTED('MyTable'[Company]))

wad11656_3-1663110506635.png

Furniture Total = Add line items with matching OPC names:

ANCILLARY PRODUCT: $32,494,925.41 + $2,907,016.22 + $14,796,661.94 = $50,198,603.57

Primary Product: $44,115,186.84 + $4,261,988.05 + $16,265,809.15 = $64,642,984.04

 

These 2 formulas seem to do the opposite of what I'm specifying. Can anyone help me understand why?

Perhaps this misunderstanding is due to me not understanding the functionality of <filter> in CALCULATE(<expression>, <filter>). Can someone help me understand?

 

Thank you

1 ACCEPTED SOLUTION
Anonymous
Not applicable

Hi @wad11656 ,

ALLSELECTED removes filter from the selected column of a table.

In your 1st example you removed filter of the [OPC] column, hence only the company filter was active.

In your 2nd example you removed filter of the [Company] column, hence only the OPC filter was active

Hope that helps

BR

View solution in original post

2 REPLIES 2
Anonymous
Not applicable

Hi @wad11656 ,

ALLSELECTED removes filter from the selected column of a table.

In your 1st example you removed filter of the [OPC] column, hence only the company filter was active.

In your 2nd example you removed filter of the [Company] column, hence only the OPC filter was active

Hope that helps

BR

So the word "filter" really means "filter OUT". Got it. Thanks!

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.