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

Earn the coveted Fabric Analytics Engineer certification. 100% off your exam for a limited time only!

Reply
Moha_shanti
Regular Visitor

How to get the max day within month list

Hi,

I have a tbale contains list of materials with Reservations approval dates, as shown below, I want to get MAX day in month for each material

the column MAX Day in Month In Material is the results required

ReservationMaterialReservation Approval dateMAX Day in Month In Material
607012113000501424619-May-2319-May-23
636819313000501424616-May-2319-May-23
636793013000501424616-May-2319-May-23
636811613000501424617-May-2319-May-23
636338213000501424618-May-2319-May-23
626555313000501424630-Apr-2330-Apr-23
621861413000501424628-Apr-2330-Apr-23
621995413000501424626-Apr-2330-Apr-23
620669613000501424625-Apr-2330-Apr-23
618609213000501424619-Apr-2330-Apr-23
617999213000501424618-Apr-2330-Apr-23
554277513000501424603-Jan-2303-Jan-23
555256813000501424603-Jan-2303-Jan-23
555182213000501424603-Jan-2303-Jan-23
554139413000501424602-Jan-2303-Jan-23
554330413000501424602-Jan-2303-Jan-23
554322613000501424602-Jan-2303-Jan-23
554308213000501424602-Jan-2303-Jan-23
607012113000501001019-May-2319-May-23
636819313000501001016-May-2319-May-23
636338213000501001018-May-2319-May-23
626555313000501001030-Apr-2330-Apr-23
621861413000501001028-Apr-2330-Apr-23
621995413000501001026-Apr-2330-Apr-23
620669613000501001025-Apr-2330-Apr-23
554277513000501001003-Jan-2303-Jan-23
1 ACCEPTED SOLUTION
johnt75
Super User
Super User

You could create a column like

MAX Day in Month In Material =
VAR MonthStart =
    EOMONTH ( 'Table'[Reservation approval date], -1 ) + 1
VAR MonthEnd =
    EOMONTH ( 'Table'[Reservation approval date], 0 )
VAR MaxDate =
    CALCULATE (
        MAX ( 'Table'[Reservation approval date] ),
        ALLEXCEPT ( 'Table', 'Table'[Material] ),
        DATESBETWEEN ( 'Table'[Reservation approval date], MonthStart, MonthEnd )
    )
RETURN
    MaxDate

View solution in original post

2 REPLIES 2
johnt75
Super User
Super User

You could create a column like

MAX Day in Month In Material =
VAR MonthStart =
    EOMONTH ( 'Table'[Reservation approval date], -1 ) + 1
VAR MonthEnd =
    EOMONTH ( 'Table'[Reservation approval date], 0 )
VAR MaxDate =
    CALCULATE (
        MAX ( 'Table'[Reservation approval date] ),
        ALLEXCEPT ( 'Table', 'Table'[Material] ),
        DATESBETWEEN ( 'Table'[Reservation approval date], MonthStart, MonthEnd )
    )
RETURN
    MaxDate

Perfect Mr.John, Thanks a lot

Helpful resources

Announcements
April AMA free

Microsoft Fabric AMA Livestream

Join us Tuesday, April 09, 9:00 – 10:00 AM PST for a live, expert-led Q&A session on all things Microsoft Fabric!

March Fabric Community Update

Fabric Community Update - March 2024

Find out what's new and trending in the Fabric Community.