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

Grow your Fabric skills and prepare for the DP-600 certification exam by completing the latest Microsoft Fabric challenge.

Reply
Anonymous
Not applicable

REMOVEFILTER in calculate with FILTER

 Hello All,

I have a measure that gives the count of parts on a condition.Simple calculate.

count of parts=
CALCULATE(
DISTINCTCOUNT(table1[Part Number]),
Table1[parttype] = "A" || Table1[parttype]= "B", 
REMOVEFILTERS()
)

And i have used the ALL so that even if any Part number is selected in the Table in the page i still get the
count of all the parts with the above condition.

 

Now if i do the below

calculate(
DISTINCTCOUNT(table1[Part Number]),
filter(Table1,Table1[parttype]="A" ||Table1[parttype]="B"),
REMOVEFILTERS()
)

Then the filters on the table come into play and i only get teh count for that specific part and do not get the
count as the above measure.

Please let me know if there is any good read to this.why the removefilter cannot be used with the FILTER??

 

Thanks

1 ACCEPTED SOLUTION
Anonymous
Not applicable

@amitchandak 

bespeck_0-1620062538852.png

Count of Parts A and B REMOVEFILTER = CALCULATE(
DISTINCTCOUNT('Order'[Part name]),
'Order'[Part Type]="A" || 'Order'[Part Type]="B",REMOVEFILTERS()
) ---Removes any filter on the visual
Count of Parts A and B FILTER = CALCULATE(
DISTINCTCOUNT('Order'[Part name]),
FILTER(ALL('Order'),'Order'[Part Type]="A" || 'Order'[Part Type]="B")
)--Similar to above removes any filter on the visual with ALL within Filter..
 
Count of Parts A and B FILTER1 = CALCULATE(
DISTINCTCOUNT('Order'[Part name]),
FILTER('Order','Order'[Part Type]="A" || 'Order'[Part Type]="B"),ALL())--The ALL has no effect on the visual filterss
 
Thanks

View solution in original post

3 REPLIES 3
amitchandak
Super User
Super User

@Anonymous , what I am getting from this read is removefilters is Table parameter inside calculate.

 

https://exceleratorbi.com.au/removefilters-in-dax/

 

Second is as per definition remove filter does not return value, if you want to use inside the filter, it needs to have a return value. 

 

https://docs.microsoft.com/en-us/dax/removefilters-function-dax

 

like all returns a table

https://docs.microsoft.com/en-us/dax/all-function-dax

 

also check

https://exceleratorbi.com.au/simple-filters-and-syntax-sugar-in-dax/

Anonymous
Not applicable

@amitchandak 

bespeck_0-1620062538852.png

Count of Parts A and B REMOVEFILTER = CALCULATE(
DISTINCTCOUNT('Order'[Part name]),
'Order'[Part Type]="A" || 'Order'[Part Type]="B",REMOVEFILTERS()
) ---Removes any filter on the visual
Count of Parts A and B FILTER = CALCULATE(
DISTINCTCOUNT('Order'[Part name]),
FILTER(ALL('Order'),'Order'[Part Type]="A" || 'Order'[Part Type]="B")
)--Similar to above removes any filter on the visual with ALL within Filter..
 
Count of Parts A and B FILTER1 = CALCULATE(
DISTINCTCOUNT('Order'[Part name]),
FILTER('Order','Order'[Part Type]="A" || 'Order'[Part Type]="B"),ALL())--The ALL has no effect on the visual filterss
 
Thanks
Anonymous
Not applicable

@amitchandak Thanks for the reply yes in the first case it acts as a table parameter for calculate.

But isnt the second also the same it is not within the filter and i thought it would act similar to the above for that case even ALL would not work with FILTER here.

Maybe i am missing something here...

Helpful resources

Announcements
RTI Forums Carousel3

New forum boards available in Real-Time Intelligence.

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

MayPowerBICarousel1

Power BI Monthly Update - May 2024

Check out the May 2024 Power BI update to learn about new features.