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

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

Reply
Mmahachi
Advocate I
Advocate I

max table filter not working

In my calendar table I have 2 columns other than my key date field one is to say 'yes' or 'no' depending on if the period has been closed by accounting and the second to show a user friendly display of the fiscal period. 

 

I have tried several formuals but most recently this simple one is providing incorrect data and I am not sure why

 

Last Period Closed = var LastClosed = CALCULATE(MAX('Calendar'[Fiscal Period Display]), FILTER(ALLEXCEPT('Calendar','Calendar'[AccountPeriodClosed]),MAX('Calendar'[AccountPeriodClosed])="Yes"))
RETURN
LastClosed
 
This returns a value of the very last fiscal period (FY30 Sep) in the table which is some 10 years in the future and therefore marked as "no" on the account closed period. 
 
Why isn't the AccountPeriodClosed filter working in this formula?
 
Ultimately I need to override some outside page filters so that I can view all the periods and then pick the last one where AccountPeriodClosed = Yes
3 REPLIES 3
amitchandak
Super User
Super User

@Mmahachi , I need some data to suggest. Try

 

Last Period Closed =
var _LastClosed = maxx(filter(allselected('Calendar'),'Calendar'[AccountPeriodClosed]="Yes"),[AccountPeriodClosed])

return
CALCULATE(MAX('Calendar'[Fiscal Period Display]), FILTER('Calendar','Calendar'[AccountPeriodClosed] =_LastClosed ))

 

or


Last Period Closed =
var _LastClosed = maxx(filter(allselected('Calendar'),'Calendar'[AccountPeriodClosed]="Yes"),[AccountPeriodClosed])

return
CALCULATE(MAX('Calendar'[Fiscal Period Display]), FILTER(allselected('Calendar'),'Calendar'[AccountPeriodClosed] =_LastClosed ))

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
harshnathani
Community Champion
Community Champion

Hi @Mmahachi ,

 

Try this measure.

 

Last Period Closed =
VAR LastClosed =
    CALCULATE (
        MAX ( 'Calendar'[Fiscal Period Display] ),
        FILTER (
            'Calendar',
            'Calendar'[AccountPeriodClosed]
        ) = "Yes"
    )
RETURN
    LastClosed

 

Regards,
Harsh Nathani
Did I answer your question? Mark my post as a solution! Appreciate with a Kudos!! (Click the Thumbs Up Button)

 

@harshnathani  you might want to keep the "yes" inside parenthesis 😄 

Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!

November Power BI Update Carousel

Power BI Monthly Update - November 2025

Check out the November 2025 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.