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

Be one of the first to start using Fabric Databases. View on-demand sessions with database experts and the Microsoft product team to learn just how easy it is to get started. Watch now

Reply
Wei_Pan
Frequent Visitor

create a DAX to derive the earliest date along the entire table

Hi I am a new Power BI user. I have a table with a date column (displayed in YYYY-MM), I want to create a DAX statement for the earliest date of the entire table based on the scope by using filter/slicer of date. For the screanshot, I wish to have the earliest date as "2020-01" for each row, so I can calcuate the interval between each date on a row level vs the earliest date. I used a "firstdate" function but it return the same date on the row level.

The internal calculation right now is based on a fixed DAX as below:

interval = DATEDIFF(date(2020,1,1),LASTDATE('original data'[date]),MONTH)
but this will not help if the scope of the date is changed by slicer/filter.

 

Wei_Pan_0-1727579372993.png

Can anyone help on that? I appreciate very much!

1 ACCEPTED SOLUTION
Jpss
Resolver II
Resolver II

@Wei_Pan 
consider using 

Earliest Date = CALCULATE(MIN('Table'[date]), ALLSELECTED())

Check the following PBIX for reference Wei_pan_solJpss.pbix


if you find this helpful, consider marking it as a solution

View solution in original post

4 REPLIES 4
Jpss
Resolver II
Resolver II

@Wei_Pan 
consider using 

Earliest Date = CALCULATE(MIN('Table'[date]), ALLSELECTED())

Check the following PBIX for reference Wei_pan_solJpss.pbix


if you find this helpful, consider marking it as a solution

Wei_Pan
Frequent Visitor

Hi Jpss, thanks for the help. This works for me now.

Ashish_Mathur
Super User
Super User

Hi,

Share some data to work with and show the expected result.  Share data in a format that can be pasted in an MS Excel file.


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/
Ashish_Mathur
Super User
Super User

Hi,

Share some data to work with and show the expected result.  Share data in a format that can be pasted in an MS Excel file.


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/

Helpful resources

Announcements
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!

Dec Fabric Community Survey

We want your feedback!

Your insights matter. That’s why we created a quick survey to learn about your experience finding answers to technical questions.

ArunFabCon

Microsoft Fabric Community Conference 2025

Arun Ulag shares exciting details about the Microsoft Fabric Conference 2025, which will be held in Las Vegas, NV.

December 2024

A Year in Review - December 2024

Find out what content was popular in the Fabric community during 2024.