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

Don't miss out! 2025 Microsoft Fabric Community Conference, March 31 - April 2, Las Vegas, Nevada. Use code MSCUST for a $150 discount. Prices go up February 11th. Register now.

Reply
oakgogo
Helper II
Helper II

how to use removefilters in MAX

for example, I want to use parametes of a certain column, and I want to remove the filters between fact[month] and dim[month]

and there is relationship between two table with month.
I want to know when a selected month and return all the first month of selected quarter to selected month with 1, and slicer is from dim[month],

from example, if dim[month]= 202302, then return a table like this:

month      cal

202301     1

202302     1

202303     0

202304     0

....

202312     0

and month columns is from fact[month]

all the value were text type.

I created a dax like this but not work because I don't know where to add the removefilters function:

cal=
VAR _a=MAX(fact[month])

RETURN
IF(_a>= SELECTEDVALUE(dim[quarter])*3-2 && _a<=SELECTEDVALUE(dim[month])

,1,0)

do you have any solution? Thank you.

 

1 ACCEPTED SOLUTION
oakgogo
Helper II
Helper II

Actually I've solved it still use removefilters, and DAX seems like this:

IF(

CALCULATE(

MAX(fact[month]), REMOVEFILTERS(dim[date])

<=SELECTEDVALUE(dim[month])

,1,0)

View solution in original post

5 REPLIES 5
oakgogo
Helper II
Helper II

Actually I've solved it still use removefilters, and DAX seems like this:

IF(

CALCULATE(

MAX(fact[month]), REMOVEFILTERS(dim[date])

<=SELECTEDVALUE(dim[month])

,1,0)

danextian
Super User
Super User

Hi @oakgogo ,

 

Using REMOVEFILTERS, as the name suggests, essentially clears the filter on the table or column it is being applied on so  CALCULATE ( MAX( 'table'[column] ), REMOVEFILTERS ('table') ) will always return the max value of [column] regardless of the filters applied to 'table'.   Use CROSSFILTER instead to change the behavior of a relationship.










Did I answer your question? Mark my post as a solution!


Proud to be a Super User!









"Tell me and I’ll forget; show me and I may remember; involve me and I’ll understand."
Need Power BI consultation, get in touch with me on LinkedIn or hire me on UpWork.
Learn with me on YouTube @DAXJutsu or follow my page on Facebook @DAXJutsuPBI.

could you provide an example to solve the situation?

In the attached sample, there is a relationship between Dates and Fact table and I disabled that in a measure using CROSSFILTER.

danextian_0-1703071285943.png

test = 
CALCULATE (
    SELECTEDVALUE ( 'Table'[effectivedate] ) <= [maxdate],
    CROSSFILTER ( 'Table'[effectivedate], Dates[Date], NONE )
)

danextian_1-1703071328053.png

 










Did I answer your question? Mark my post as a solution!


Proud to be a Super User!









"Tell me and I’ll forget; show me and I may remember; involve me and I’ll understand."
Need Power BI consultation, get in touch with me on LinkedIn or hire me on UpWork.
Learn with me on YouTube @DAXJutsu or follow my page on Facebook @DAXJutsuPBI.

Thank you, does this crossfilter have to use along with calculate? how about without using calculate? 

Helpful resources

Announcements
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount! Prices go up Feb. 11th.

Feb2025 Sticker Challenge

Join our Community Sticker Challenge 2025

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

Jan25PBI_Carousel

Power BI Monthly Update - January 2025

Check out the January 2025 Power BI update to learn about new features in Reporting, Modeling, and Data Connectivity.

Jan NL Carousel

Fabric Community Update - January 2025

Find out what's new and trending in the Fabric community.