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

Enhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.

Reply
Anonymous
Not applicable

DAX Filter on dates

Hello noob BI user here,

 

I have a large table with a set of dates and reliated market values. I have a slicer set up which allows the user to set the time period they want to analyse the data over, i.e betweem Aug 5th 2019 to Sep 5th 2019.  

 

Given the selected start and end period that the user choose to analyse over, using the slicer. I need to create a meaure that records the market value at the start date and end date periods. Below is an example of some dates and data:

 

DateMV
22/04/201922
22/04/20193423
15/06/20192354
01/07/2019-456
14/09/201945

 

I used the following code in my measures

 

Start Date = FIRSTDATE(test[Date])  <- This works and changes as the slicer date range changes
 
First Settlement = SUMX(FILTER(test, test[Date] = [Start Date] ), test[MV])  <- Doesn't work and returns the sum of ALL of the market values (5388)
 
I used the same code premis on the following table and got the right answer...
CodeMV
A22
A3423
B2354
C-456
D45

 

First Settlement = SUMX(FILTER(test, test[Code] = "A" ), test[MV])    returns 3445

 

 

 

Help me please!

1 ACCEPTED SOLUTION
Nathaniel_C
Community Champion
Community Champion

Hi @Anonymous ,

Is this what you are looking for? I did note that one date was duplicated which I changed as I did not think we could have two market values on same date. 

 

First date = FIRSTDATE(markv[Date])
Last Date = LASTDATE(markv[Date])
Market Value First Date = CALCULATE(MAX(markv[MV]),FILTER(markv,MIN(markv[Date])=[First date]))
Market Value Last date = CALCULATE(MAX(markv[MV]),FILTER(markv,MAX(markv[Date])=[Last Date]))

If this solves your issues, please mark it as the solution, so that others can find it easily. Kudos are nice too.
Nathaniel

 

First date last date.PNG





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

Proud to be a Super User!




View solution in original post

2 REPLIES 2
Nathaniel_C
Community Champion
Community Champion

Hi @Anonymous ,

Is this what you are looking for? I did note that one date was duplicated which I changed as I did not think we could have two market values on same date. 

 

First date = FIRSTDATE(markv[Date])
Last Date = LASTDATE(markv[Date])
Market Value First Date = CALCULATE(MAX(markv[MV]),FILTER(markv,MIN(markv[Date])=[First date]))
Market Value Last date = CALCULATE(MAX(markv[MV]),FILTER(markv,MAX(markv[Date])=[Last Date]))

If this solves your issues, please mark it as the solution, so that others can find it easily. Kudos are nice too.
Nathaniel

 

First date last date.PNG





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

Proud to be a Super User!




Anonymous
Not applicable

Thank you!!!!!!!

 

In this case you can have two market values on the same date so I use sum in place of max:

 

Market Value First Date = CALCULATE(sum(markv[MV]),FILTER(markv,MIN(markv[Date])=[First date]))

Thanks Nathaniel for your help

 

 

Helpful resources

Announcements
July PBI25 Carousel

Power BI Monthly Update - July 2025

Check out the July 2025 Power BI update to learn about new features.

Join our Fabric User Panel

Join our Fabric User Panel

This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.

June 2025 community update carousel

Fabric Community Update - June 2025

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