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

Enhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends September 15. Request your voucher.

Reply
Anonymous
Not applicable

Removefilters not working on a column in the date table

Dear Gurus,

 

I was trying to use removefilters on the 'Short Month' column. I was expecting the same result which is 1/12/2022 on every single row. but the result is as below.

Justinguo_1-1651214992304.png

However, when I change the column to 'Month Number', it works as expected.

Justinguo_2-1651215050266.png

Any idea why that is? thanks

The date table is formulared as below.

Justinguo_4-1651215215125.png

 

 

1 ACCEPTED SOLUTION
Anonymous
Not applicable

Hi @Anonymous ,

 

As far as I know, this result should be caused by [Month Number] column in your visual. You add [Month Number] in Matrix Row Field. So [Month Number] should be the key column, you must add  [Month Number] in REMOVEFILTER function to achieve your goal. There is no [Short Month] in Matrix, so remove filter based on [Short Month] won't work.

Ex:

Measure1 = CALCULATE(LASTDATE('Table'[Date]),REMOVEFILTERS('Table'[Month Number]))
Measure2 = CALCULATE(LASTDATE('Table'[Date]),REMOVEFILTERS('Table'[Short Month]))

RicoZhou_0-1651801990144.png

I can reproduce your problem, when only add [Month Number], [Measure 1] show remove filter result and [Measure 2] only show max date in each month.

If I replace [Month Number] by [Short Month], I will get the same problem. So we must add key columns to remove filter.

RicoZhou_1-1651802300815.png

And I find that if we sort [Short Name] by [Month Number], key column will be both [Short Name] and [Month Number] when we only add [Short Name] to Matrix Row. Then we need to use below code to get result.

Measure3 = CALCULATE(LASTDATE('Table'[Date]),REMOVEFILTERS('Table'[Month Number],'Table'[Short Month]))

 

Best Regards,
Rico Zhou

 

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

 

 

View solution in original post

5 REPLIES 5
Anonymous
Not applicable

Hi @Anonymous ,

 

As far as I know, this result should be caused by [Month Number] column in your visual. You add [Month Number] in Matrix Row Field. So [Month Number] should be the key column, you must add  [Month Number] in REMOVEFILTER function to achieve your goal. There is no [Short Month] in Matrix, so remove filter based on [Short Month] won't work.

Ex:

Measure1 = CALCULATE(LASTDATE('Table'[Date]),REMOVEFILTERS('Table'[Month Number]))
Measure2 = CALCULATE(LASTDATE('Table'[Date]),REMOVEFILTERS('Table'[Short Month]))

RicoZhou_0-1651801990144.png

I can reproduce your problem, when only add [Month Number], [Measure 1] show remove filter result and [Measure 2] only show max date in each month.

If I replace [Month Number] by [Short Month], I will get the same problem. So we must add key columns to remove filter.

RicoZhou_1-1651802300815.png

And I find that if we sort [Short Name] by [Month Number], key column will be both [Short Name] and [Month Number] when we only add [Short Name] to Matrix Row. Then we need to use below code to get result.

Measure3 = CALCULATE(LASTDATE('Table'[Date]),REMOVEFILTERS('Table'[Month Number],'Table'[Short Month]))

 

Best Regards,
Rico Zhou

 

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

 

 

Anonymous
Not applicable

Thanks Rico for your explanation. I still have one doubt though.

You mentioned I need to add short month as the 'key column' which I already did. see this 

Justinguo_0-1651803162469.png

 

Not sure how you achieved the result on yours. That is what I wanted to achieve.

Justinguo_1-1651803204093.png

 

Anonymous
Not applicable

Hi @Anonymous ,

 

Here [Short Month] is not sorted by [Month Number], so we will see it is sorted as text. Just add this column in matrix row. If you sort  [Short Month] by [Month Number], you need measure3.

RicoZhou_0-1651803637728.png

 

I will attatch my sample file and I hope it could help you.

 

Best Regards,
Rico Zhou

 

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Anonymous
Not applicable

thank you !! got it now

PC2790
Community Champion
Community Champion

In the Date Table, you have formatted ShortMonth as text and Month Number is still considered as retreived value form Date.

so when you use REMOVEFILTERS on Short Month, Power BI is not able to interpret the command and hence doesn't show the required result.

However the Month Number works due to the datatype

Helpful resources

Announcements
August Power BI Update Carousel

Power BI Monthly Update - August 2025

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

August 2025 community update carousel

Fabric Community Update - August 2025

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