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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

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
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

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

April Fabric Community Update

Fabric Community Update - April 2024

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

Top Solution Authors