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
shelbsassy
Resolver I
Resolver I

How to get the max service date of data per month for a calculated column by each month

I am trying to get the max service date per month and load into a column.  I have this working in another workbook but it won't for some reason replicate.  My formula is 

 

MaxPerMonth = Calculate(Max(Members_Claims[SERVICE_DT]),FILTER('2017dates','2017dates'[YearMonth] = EARLIER('2017dates'[YearMonth])))

 

Which is giving me the max of the data in the entire dataset which is 11/1.  I am trying to have a column like this:

First Date     MaxDataPerMonth

1/1/2017     1/31/2017

2/1/2017     2/28/2017

.....

11/1/2017   11/1/2017  Because we only have data as of 11/1 right now.

Any ideas?  Thanks

1 ACCEPTED SOLUTION

Thanks for responding.  I tried your formula but it did not work but it gave me a jumpstart and I ended up with

 

DataDay = if(max(Members_Claims[SERVICE_DT])>'2017dates'[Date],Endofmonth(Members_Claims[SERVICE_DT]),MAX(Members_Claims[SERVICE_DT]))

 

which gave me 1/31/2017, 2/28/2017, .......11/1/2017 which is what I needed but it left me with some blank rows in the DataDay column so used the Summarize function to create a new table that eliminated the blank rows.

 

Thanks for your help!

View solution in original post

3 REPLIES 3
v-shex-msft
Community Support
Community Support

HI @shelbsassy,

 

You can refer to below steps to simply get first date and max date of current month.

Steps:

1. Drag date column to table visual, switch it to hierarchy mode and keep year month.
2. Add above column twice to table visual, switch them to normal date mode and modify summary mode to 'earliest' and 'latest'.

2.PNG

calendar Last Date is 11/9/2017, so last month max date is 11/9/2017.

 

 

Regards,

Xiaoxin Sheng

Community Support Team _ Xiaoxin
If this post helps, please consider accept as solution to help other members find it more quickly.
Interkoubess
Solution Sage
Solution Sage

Hi @shelbsassy,

 

I created this column with this formula where I have got my table Data and its field Date. Please give us a dummy sample if it did not solve your problem.

 

Test =
IF (
    MAX ( Data[Date] ) > Data[Date],
    ENDOFMONTH ( Data[Date] ),
    MAX ( Data[Date] )
)

Thx

 

Ninter

Thanks for responding.  I tried your formula but it did not work but it gave me a jumpstart and I ended up with

 

DataDay = if(max(Members_Claims[SERVICE_DT])>'2017dates'[Date],Endofmonth(Members_Claims[SERVICE_DT]),MAX(Members_Claims[SERVICE_DT]))

 

which gave me 1/31/2017, 2/28/2017, .......11/1/2017 which is what I needed but it left me with some blank rows in the DataDay column so used the Summarize function to create a new table that eliminated the blank rows.

 

Thanks for your help!

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.