cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
Frequent Visitor

Extracting the last date in a column based on the data in another using a measure

I have a table with one column containing repeating values or "Source" and another column containing just the “Date” for each record. I am trying to display the first/last date for each “Source”, but when I use the following formula I get a date in the middle of the range. I am newer to PBI so any help would be greatly appreciated! Below is a sample of the data I am talking about.

 

Date - End = DATEVALUE(Calculate(Max('Data Source'[Date])))

Date - End = max('1 Date Source'[Date])

SourceDateType
Month 11/12/2020AOH
Month 11/13/2020AGN
Month 11/14/2020QXP
Month 11/15/2020AOH
Month 11/16/2020QXP
Month 33/23/2020AGN
Month 33/24/2020QXP
Month 33/25/2020QXP
Month 33/26/2020AOH

 

 same for Date - Start, just using Min

 

How would I say that Month 1 was from 1/12/2020 – 1/16/2020 and month 3 was 3/23/2020 – 3/26/2020? I tried using a table visualization and adding the Values of “Source”, the measure I made “Date – Start” and “Date – End”, but I am getting Month 1 1/15 – 1/15 and month 3 as 3/24 – 3/24.

 

1 ACCEPTED SOLUTION

Accepted Solutions
Highlighted
Super User IV
Super User IV

Re: Extracting the last date in a column based on the data in another using a measure

@DreDre - Perhaps I am not understanding what you are going for here. See attached PBIX, is that what you want?

 


---------------------------------------

Putting square pegs in round holes since 1972.

I have a NEW book! 
DAX Cookbook from Packt
Over 120 DAX Recipes!




Did I answer your question? Mark my post as a solution!

Proud to be a Super User!




View solution in original post

4 REPLIES 4
Highlighted
Super User IV
Super User IV

Re: Extracting the last date in a column based on the data in another using a measure

@DreDre - You should just need to do MIN and MAX assuming that your column is really a date column and not text for example. 


---------------------------------------

Putting square pegs in round holes since 1972.

I have a NEW book! 
DAX Cookbook from Packt
Over 120 DAX Recipes!




Did I answer your question? Mark my post as a solution!

Proud to be a Super User!




Highlighted
Frequent Visitor

Re: Extracting the last date in a column based on the data in another using a measure

@Greg_Deckler - When using the Min/Max, it ends up pulling a date in the table that matches the "Source" but is the same date for the Start/End which is where I am hitting the wall. The column is filtered as a date which I thought would be the fix, but I am still stumped. 

Highlighted
Super User IV
Super User IV

Re: Extracting the last date in a column based on the data in another using a measure

@DreDre - Perhaps I am not understanding what you are going for here. See attached PBIX, is that what you want?

 


---------------------------------------

Putting square pegs in round holes since 1972.

I have a NEW book! 
DAX Cookbook from Packt
Over 120 DAX Recipes!




Did I answer your question? Mark my post as a solution!

Proud to be a Super User!




View solution in original post

Highlighted
Frequent Visitor

Re: Extracting the last date in a column based on the data in another using a measure

@Greg_Deckler I went to create a sample of what I was trying to explain and your right it looks like the min/max do work exactly as they should have so there is a problem with my underlying data that I need to root out. I appreciate your quick response!

Helpful resources

Announcements
Community Blog

Community Blog

Visit our Community Blog for articles, guides, and information created by fellow community members.

Using the Community

Using the Community

Need help with the Power BI Community? Our 'Using the Community' support articles are a great place to start.

Community Summit North America

Community Summit North America

Innovate, Collaborate, Grow. The top training and networking event across the globe for Microsoft Business Applications

Power Platform 2020 release wave 2 plan

Power Platform 2020 release wave 2 plan

Features releasing from October 2020 through March 2021

Top Solution Authors
Top Kudoed Authors