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

Next up in the FabCon + SQLCon recap series: The roadmap for Microsoft SQL and Maximizing Developer experiences in Fabric. All sessions are available on-demand after the live show. Register now

Reply
diogobraga2
Helper IV
Helper IV

Calculation to return value based on maximum date and maximum year

The goal is to create a dynamic calculation that will show the 'Returning Rate' for the maximum 'Date Adj' for the maxium 'Academic Year' per school per grade. 

Based on this dataset the 'Returning Rate MAX' calculation should return the rates for maximum 'Academic Year' is 2020-2021 and the maxium 'Data Adj' is 08/24.

Refer to the pbix on this link. Thanks for you help! 

1 ACCEPTED SOLUTION
Ashish_Mathur
Super User
Super User

Hi,

To a matrix visual, i dragged the School Code anf Grade Level and then wrote these measures

Measure = MAX('result (5)'[Academic Year])
Measure 2 = MAX('result (5)'[Date])

Hope this helps.

Untitled.png


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

View solution in original post

2 REPLIES 2
Ashish_Mathur
Super User
Super User

Hi,

To a matrix visual, i dragged the School Code anf Grade Level and then wrote these measures

Measure = MAX('result (5)'[Academic Year])
Measure 2 = MAX('result (5)'[Date])

Hope this helps.

Untitled.png


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

Hi @diogobraga2,

If you mean to get the static value based on current table records groups, this is possible. You can try to use following calculated column formula:

 

Academic Year MAX =
CALCULATE (
    MAX ( 'result (5)'[Academic Year] ),
    FILTER (
        'result (5)',
        [School Code] = EARLIER ( 'result (5)'[School Code] )
            && [Grade Number] = EARLIER ( 'result (5)'[Grade Number] )
    )
)

Date MAX =
CALCULATE (
    MAX ( 'result (5)'[Date Adj] ),
    FILTER (
        'result (5)',
        [School Code] = EARLIER ( 'result (5)'[School Code] )
            && [Grade Number] = EARLIER ( 'result (5)'[Grade Number] )
    )
)

 

If you mean to create dynamic column fields based on filters, this is impossible.

Currently, you can't create a dynamic calculated column/table based filters. They are stored in different data levels and parent level data model(calculated column/table) not respond with the child level(measure, visual, filter, slicer) effects.

Notice: the data level of power bi.

Database(external) -> query table(query, custom function, query parameters) -> data model table(table, calculate column/table) -> virtual table of data view(measure, visual, filter, slicer)
Regards,

Xiaoxin Sheng

Helpful resources

Announcements
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.

FabCon and SQLCon Highlights Carousel

FabCon &SQLCon Highlights

Experience the highlights from FabCon & SQLCon, available live and on-demand starting April 14th.

March Power BI Update Carousel

Power BI Community Update - March 2026

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