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

Find everything you need to get certified on Fabric—skills challenges, live sessions, exam prep, role guidance, and more. Get started

Reply
arhomberg
Helper I
Helper I

Determine most recent day in list for each month in a year

Hello Everyone,

 

I have a table that has a list of dates, and I would like to create a new column that goes through and finds the most recent date listed within every month for each year.

 

Here is an example of what I would like to do:

arhomberg_0-1625673312459.png


2/10 is the most recent day listed in Feb of 2020 so it receives a 1 and March 31 is the most recent day in March of 2020 so it receives a 1.

Any advice would be greatly appreciated, thanks!

1 ACCEPTED SOLUTION
Anonymous
Not applicable

[Is Most Recent...] = // calculated column
var CurrentDate = T[Date to Check]
var MonthStart = EOMONTH( CurrentDate, -1 ) + 1
var NextMonthStart = EOMONTH( CurrentDate, 0 ) + 1
var Result =
    CurrentDate = MAXX(
        filter(
            T,
            MonthStart <= T[Date to Check]
            &&
            T[Date to Check] < NextMonthStart
        ),
        T[Date to Check]
    )
return
    1 * Result

View solution in original post

1 REPLY 1
Anonymous
Not applicable

[Is Most Recent...] = // calculated column
var CurrentDate = T[Date to Check]
var MonthStart = EOMONTH( CurrentDate, -1 ) + 1
var NextMonthStart = EOMONTH( CurrentDate, 0 ) + 1
var Result =
    CurrentDate = MAXX(
        filter(
            T,
            MonthStart <= T[Date to Check]
            &&
            T[Date to Check] < NextMonthStart
        ),
        T[Date to Check]
    )
return
    1 * Result

Helpful resources

Announcements
Europe Fabric Conference

Europe’s largest Microsoft Fabric Community Conference

Join the community in Stockholm for expert Microsoft Fabric learning including a very exciting keynote from Arun Ulag, Corporate Vice President, Azure Data.

Power BI Carousel June 2024

Power BI Monthly Update - June 2024

Check out the June 2024 Power BI update to learn about new features.

RTI Forums Carousel3

New forum boards available in Real-Time Intelligence.

Ask questions in Eventhouse and KQL, Eventstream, and Reflex.