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

Vote for your favorite vizzies from the Power BI Dataviz World Championship submissions. Vote now!

Reply
ARomain57
Frequent Visitor

Remove Dropdown filter from a measure

I am trying to create a measure that shows the last 5 attempts at getting consent when approached. However, I have a Year dropdown [Request Date] filter at the top of the page set to 2024, and sometimes, the last 5 attempts go back into 2023 or beyond.

 

 

The code below works, but it filters the last 5 attempts to 2024, due to the Year dropdown. I can't figure out how to ignore the dropdown (filtering by Request Date), but also use the same date (Request Date) in the measure. I have tried using ALL or REMOVEFILTERS, as I keep getting an error or wrong answer.

 

Last 5 =

VAR Last5Attempts = TOPN(5,FILTER('Table1',NOT(ISBLANK([Request Date])) && [Approached] = "Yes"),[Request Date],DESC) RETURN

COUNTROWS(FILTER(Last5Attempts,[Consent] = "Yes"))

 

Below is my page with the Year filter set to 2024. The year is using the Request Date.

 

The Last 5 attemps is the correct data using my code above. But again, it is limited to the 2024 dropdown. 

ARomain57_0-1727803333249.png

 



2 REPLIES 2
marcelsmaglhaes
Super User
Super User

Hey @ARomain57 

Try the meauser bellow:

Last 5 =
VAR Last5Attempts =
TOPN(
5,
FILTER(
ALL('Table1'[Request Date]),
NOT(ISBLANK([Request Date])) && [Approached] = "Yes"
),
[Request Date],
DESC
)
RETURN
COUNTROWS(FILTER(Last5Attempts, [Consent] = "Yes"))
-----------------------------------------------------------------------------------------------------------------------
***ALL('Table1'[Request Date]): This removes any external filters applied on Request Date (such as your Year dropdown), so you can still retrieve data beyond the year 2024.


Regards,
Marcel Magalhães
Microsoft Power BI Official Partner
MCT | Certified PL-300 Power BI

If I've helped, don't forget to mark my post as a solution!



I tried that before and it gives me an error.

 

A single value for column 'Approached' in 'Table1' cannot be determined. This can happen when a measure formula refers to a column that contains many values without specificying an aggregation. 

When I just use ALL('Table1'), I get the wrong value

Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

Vote for your favorite vizzies from the Power BI World Championship submissions!

Sticker Challenge 2026 Carousel

Join our Community Sticker Challenge 2026

If you love stickers, then you will definitely want to check out our Community Sticker Challenge!

January Power BI Update Carousel

Power BI Monthly Update - January 2026

Check out the January 2026 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.