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

Get certified in Microsoft Fabric—for free! For a limited time, get a free DP-600 exam voucher to use by the end of 2024. Register now

Reply
nick9000
Frequent Visitor

Filter Sales by a date

Hi,

 

I am looking to show sales information for employees three months after they have started. I have the start date in a table and have created a measure for the 3 month date or x month date:

 

3mth Date = EOMONTH(FIRSTDATE(date[start date],3)

 

I then created a measure to try and filter on the 3 mth date but it would only pull all sales to date effectivley no filter applied. I've included the DAX in a screencap below:

 

 

sales table.PNG

The intended result wuold be to have the measure displaying sales either on the 3mth date or up to the 3mth date ie:

Employee 1 would show 100 (on the date) or 110 (up to and including the date)

 

 

If someone could help me with this out or point in the right direction it would be much appreciated.

 

Thanks

 

Nick

 

 

1 ACCEPTED SOLUTION

Awesome, Thanks Yggdrasill

 

I made a couple of changes and seems to give the correct result. Two references to the sales table and the other two are to the employee table.

 

3 month revenue =
CALCULATE(sum(Sales[Amount]),
DATESBETWEEN(
Sales[Date],
FIRSTDATE(Employee[Start Date]),
eomonth(FIRSTDATE(Employee[Start Date]),2)
)
)

 

Thanks

 

Nick

View solution in original post

5 REPLIES 5
Ashish_Mathur
Super User
Super User

Hi,

 

It is difficult to help unless one sees the relatioships and the different tables.  Share the link from where i can download your workbook.


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

Try DATESBETWEEN()

thanks Yggdrasill, I couldn't get DATESBETWEEN to work

I tried your scenario

 

This is what you need

 

3M from startdate =
CALCULATE (
    SUM ( Table1[Amount] ),
    DATESBETWEEN (
        Table1[start date],
        FIRSTDATE ( Table1[start date] ),
        DATEADD ( FIRSTDATE ( Table1[start date] ), 3, MONTH )
    )
)

Then create a visual table and insert employee and then this measure to get this

 

employee & 3 month sale measureemployee & 3 month sale measure

Awesome, Thanks Yggdrasill

 

I made a couple of changes and seems to give the correct result. Two references to the sales table and the other two are to the employee table.

 

3 month revenue =
CALCULATE(sum(Sales[Amount]),
DATESBETWEEN(
Sales[Date],
FIRSTDATE(Employee[Start Date]),
eomonth(FIRSTDATE(Employee[Start Date]),2)
)
)

 

Thanks

 

Nick

Helpful resources

Announcements
November Carousel

Fabric Community Update - November 2024

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

Live Sessions with Fabric DB

Be one of the first to start using Fabric Databases

Starting December 3, join live sessions with database experts and the Fabric product team to learn just how easy it is to get started.

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! Early Bird pricing ends December 9th.

Nov PBI Update Carousel

Power BI Monthly Update - November 2024

Check out the November 2024 Power BI update to learn about new features.