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

Get Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Request now

Reply
Teapotlid
Frequent Visitor

Max filtered by a category and over time

I’m new to PowerBI/DAX and want the max over both a criterion and over time but am having difficulty.

 

I have people's desired approximate weekly hours which they can flex by month (example Availabity table below). 

I want to show the max availability per person over a set period of time (e.g. a year / quarter).

I have a Date table, a People table and an Available table.

I built a bar chart using a Max by person measure (formula below) and hoped that a date range slider (from my Date table) could be used to filter it by year/quarter.

There's a 1 to many relationship between the People table and the Availability table (linked using fullname - not shown in the table below) and also 1 to many between the Date table and Availability table (linked using date shown in the Month column below).

Regardless of what I do with the Date range slider, I just see the max per person. 

I want Raj to show 40 in 2022 but 32 in 2023 and Penny to show 32 in 2022 and 40 in 2023 (I get 40 for each of them whatever the date range).

 

Any tips / ideas?

Many thanks in advance.

 

 
NameMonthWklyHrs
Raj1-Nov-2240
Raj1-Dec-2240
Raj1-Jan-2332
Raj1-Feb-2332
Penny1-Nov-2220
Penny1-Dec-2232
Penny1-Jan-2340
Penny1-Feb-2340
 
Max of WklyHrs per Person=
MAXX(
    KEEPFILTERS(VALUES('People'[Name])),
    CALCULATE(MAX('Available'[WklyHrs]))
)
3 REPLIES 3
Ashish_Mathur
Super User
Super User

Hi,

You may download my PBI file from here.

Hope this helps.

Untitled.png


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/

Thank you Ashish, it works in a table where you can select a single year (and I love the simplicity) but it doesn't seem to work for a date range slider.

I applied it to my real data and, if people select a range that straddles years, it shows the sum of the max for those 2 (or 3 years). Using my example, if the date range slider is set to the range 1-Nov-2022 to 28-Feb-2023, Raj shows 72 (the 40 max for 2022 & the 32 max for 2023).

Is there any tweak that would fix it?

Many thanks in advance!

 

You are welcome.  Show the expected result very clearly.


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/

Helpful resources

Announcements
Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

October Power BI Update Carousel

Power BI Monthly Update - October 2025

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

Top Solution Authors