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

A new Data Days event is coming soon! This time we’re going bigger than ever. Fabric, Power BI, SQL, AI and more. Don't miss out.

Reply
adityo
Frequent Visitor

ignore filters when sum amount based on Max Year

Hi All,

I want to make calculations Current year*,that ignore my filter selections

*Current Year calculation is sum of amount of Max of Current year in AP_Database table 

 

here are my scheme :

Date.Clearing one to many AP_Database.Clearing

adityo_0-1629166828398.png

 
here are my measures
Current Year New =
var MaxYear = CALCULATE(MAX('Date'[Year Outgoing]), ALL('Date'[Year Outgoing]))
RETURN
CALCULATE(SUM(AP_Database[Amount in local cur.]),FILTER(ALL('Date'[Year Outgoing]), 'Date'[Year Outgoing]=MaxYear))

 

but it seems doesn't work.

When i filtered table Date, it also filtered the Current Year New

1 ACCEPTED SOLUTION
Anonymous
Not applicable

Hi @adityo ,

 

It is because you are using ALL() function in the formula. Try using ALLEXCEPT() function instead.

measure 1 = CALCULATE(SUM(AP_Database[Amount in local cur.]),FILTER(ALLEXCEPT(AP_Database,AP_Database[category]), YEAR(AP_Database[Clearing])=MaxYear))

measure 2 = CALCULATE(SUM(AP_Database[Amount in local cur.]),FILTER(ALL(AP_Database), YEAR(AP_Database[Clearing])=MaxYear&&AP_Database[category]=SELECTEDVALUE(AP_Database[category])))

 If both the above measures don't work, please show some sample data and expected result to us.

 

Best Regards,

Jay

View solution in original post

7 REPLIES 7
Anonymous
Not applicable

Hi @adityo 

 

Current Year New =
var MaxYear = CALCULATE(MAX('Date'[Year Outgoing]), ALL('Date'[Year Outgoing]))
RETURN
CALCULATE(SUM(AP_Database[Amount in local cur.]),FILTER(ALL(AP_Database), YEAR(AP_Database[Clearing])=MaxYear))
 
You need to use the date in AP_Database to match the date in Date table.
 
Best Regards,
Jay

Im aorey but this is one of the worst advice I saw on this forum.

 

For god sake, dont use filter( All(Ap_database)). What if this table has million rows, you will end up iterating on all the rows.

 

  • Always filter colums in the dimensions and use the relationship.

The approach from @amitchandak is really better in this case.

@Anonymous it seems work.... it calculates the current year. but i think it will mislead the context. while im using matrix for the visualization, all the number are same for all category....

Anonymous
Not applicable

Hi @adityo ,

 

It is because you are using ALL() function in the formula. Try using ALLEXCEPT() function instead.

measure 1 = CALCULATE(SUM(AP_Database[Amount in local cur.]),FILTER(ALLEXCEPT(AP_Database,AP_Database[category]), YEAR(AP_Database[Clearing])=MaxYear))

measure 2 = CALCULATE(SUM(AP_Database[Amount in local cur.]),FILTER(ALL(AP_Database), YEAR(AP_Database[Clearing])=MaxYear&&AP_Database[category]=SELECTEDVALUE(AP_Database[category])))

 If both the above measures don't work, please show some sample data and expected result to us.

 

Best Regards,

Jay

Thx @Anonymous it works perfect!

amitchandak
Super User
Super User

@adityo , Try one of the two

 

Current Year New =
var MaxYear = year(today())
RETURN
CALCULATE(SUM(AP_Database[Amount in local cur.]),FILTER(ALL('Date'[Year Outgoing]), 'Date'[Year Outgoing]=MaxYear))


Current Year New =
var MaxYear = maxx(all('Date'), 'Date'[Year Outgoing])
RETURN
CALCULATE(SUM(AP_Database[Amount in local cur.]),FILTER(ALL('Date'[Year Outgoing]), 'Date'[Year Outgoing]=MaxYear))

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

@amitchandak thank you for your response, unfortunately both of them doesn't works. the DAX script doesn't return error. but it keep filtered.

Helpful resources

Announcements
May Power BI Update Carousel

Power BI Monthly Update - May 2026

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

Fabric SQL PBI Data Days

Data Days 2026 coming soon!

Sign up to receive a private message when registration opens and key events begin.

New to Fabric survey Carousel

New to Fabric Survey

If you have recently started exploring Fabric, we'd love to hear how it's going. Your feedback can help with product improvements.

Power BI DataViz World Championships carousel

Power BI DataViz World Championships - June 2026

A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.