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
Anonymous
Not applicable

Filter Date column by lastdate of other column date

Hello everyone, hoping for you and your family safety nowadays,

 

Is it possible to create a measure that I will filter the date of one column based on the last date available from another column? The purpose of this formula is to compare two values from the same day. Below is my formula Sample;

 

Sample = CALCULATE(SUM('All'[Value]),'All'[Year]=2019,'All'[Sameday]=LASTDATE('All'[Date]))
1 ACCEPTED SOLUTION

Hi @Anonymous 

 

Sorry again for the late reply!

Pls see the solution below:

1. Create a measure as below:

 

Measure = 
var _maxdate=MAXX(ALL('Original Date Same Year Same Day Year ValueTable'),'Original Date Same Year Same Day Year ValueTable'[Original Date])
Return
CALCULATE(SUM('Original Date Same Year Same Day Year ValueTable'[Value]),FILTER('Original Date Same Year Same Day Year ValueTable','Original Date Same Year Same Day Year ValueTable'[Year]=2019&&'Original Date Same Year Same Day Year ValueTable'[Same Year]<=_maxdate))

 

And you will see:

Annotation 2020-04-27 165556.png

For the related .pbix file,pls click here.

 

Best Regards,
Kelly
Did I answer your question? Mark my post as a solution!

View solution in original post

9 REPLIES 9
v-kelly-msft
Community Support
Community Support

Hi  @Anonymous ,

 

Sorry for the late reply.Are the 2 columns in the same table?If not,does the 2 tables have relationships betwee?Can you provide more details such as sample data and the expected output to make your require more clear?

 

Best Regards,
Kelly
Did I answer your question? Mark my post as a solution!

 

Anonymous
Not applicable

Hello @v-kelly-msft ,

 

Yes, two columns are in the same table.

I have a table with 4 date columns and 1 value as shown below;

Original DateSame YearSame DayYearValue
January 1, 2020January 1, 2020January 1, 20202020231
January 2, 2020January 2, 2020January 2, 20202020214
January 3, 2020January 3, 2020January 3, 20202020321
January 4, 2020January 4, 2020January 4, 20202020531
January 5, 2020January 5, 2020January 5, 20202020613
January 1, 2019January 1, 2020December 31, 2019201961
January 2, 2019January 2, 2020January 1, 2020201935
January 3, 2019January 3, 2020January 2, 20202019213
January 4, 2019January 4, 2020January 3, 20202019534
January 5, 2019January 5, 2020January 4, 20202019742
January 6, 2019January 6, 2020January 5, 202020193
January 7, 2019January 7, 2020January 6, 202020196,342

 

I want to Sum up the value column by YTD, MTD, or Last date by the same day or same year column which will always be based on the last date of the original column. I tried some measure but it is not working;

 

MTD = CALCULATE(SUM('Table'[Value]),YEAR('Table'[Year])=2019,DATESMTD('Table'[Same year]))
 
the above formula is working but, I want to filter that I should be only until January 5, 2020 (or which is the latest date from the original date column) because all data for 2019 is included in the table.

Hi @Anonymous 

 

Sorry again for the late reply!

Pls see the solution below:

1. Create a measure as below:

 

Measure = 
var _maxdate=MAXX(ALL('Original Date Same Year Same Day Year ValueTable'),'Original Date Same Year Same Day Year ValueTable'[Original Date])
Return
CALCULATE(SUM('Original Date Same Year Same Day Year ValueTable'[Value]),FILTER('Original Date Same Year Same Day Year ValueTable','Original Date Same Year Same Day Year ValueTable'[Year]=2019&&'Original Date Same Year Same Day Year ValueTable'[Same Year]<=_maxdate))

 

And you will see:

Annotation 2020-04-27 165556.png

For the related .pbix file,pls click here.

 

Best Regards,
Kelly
Did I answer your question? Mark my post as a solution!
Anonymous
Not applicable

@v-kelly-msft  Thank you so much, it worked.

Hi @Anonymous 

 

Sorry again for the late reply!

Pls see the solution below:

1. Create a measure as below:

Measure = 
var _maxdate=MAXX(ALL('Original Date Same Year Same Day Year ValueTable'),'Original Date Same Year Same Day Year ValueTable'[Original Date])
Return
CALCULATE(SUM('Original Date Same Year Same Day Year ValueTable'[Value]),FILTER('Original Date Same Year Same Day Year ValueTable','Original Date Same Year Same Day Year ValueTable'[Year]=2019&&'Original Date Same Year Same Day Year ValueTable'[Same Year]<=_maxdate))

And you will see:

Annotation 2020-04-27 165556.png

For the related .pbix file,pls click here.

 

Best Regards,
Kelly
Did I answer your question? Mark my post as a solution!
Anonymous
Not applicable

Up

Anonymous
Not applicable

Help please.

Anonymous
Not applicable

Up

Anonymous
Not applicable

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.