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

Get Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Learn more

Reply
ClemFandango
Advocate II
Advocate II

Sum column based on if date is between two dates

Hi there,

 

I have the following tables, and i am trying to count the number of rows in 'Table 2' where 'Lost' = 1 and the data in 'Table 1' is the same month. I am trying to do this by adding a custom column to 'table 1' using DAX.

 

Table 1 - Example

ClemFandango_3-1707747652428.png

MMYYDD = end of month

 

Table 2 Example:-

ClemFandango_2-1707747573041.png

 

Example of data from Table 2

Expanded_DateLost
01/09/231
02/09/230
03/09/231
01/10/231
15/12/231

 

I am hoping to achieve the following in 'Table 1' by adding a calculated column called 'Lost':-

MMYYDDLost
30/09/232
31/10/231
30/11/230
31/12/231
31/01/240
29/02/240

 

Any ideas or help greatly appreciated!

 

CF

 

 

 

 

1 ACCEPTED SOLUTION
amitchandak
Super User
Super User

@ClemFandango , a new column in dax in Table 1

 

countx(filter(Table2, eomonth(Table1[Date], 0)  = eomonth(Table2[date],0) && [Lost] =1), [Lost])

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

View solution in original post

2 REPLIES 2
amitchandak
Super User
Super User

@ClemFandango , a new column in dax in Table 1

 

countx(filter(Table2, eomonth(Table1[Date], 0)  = eomonth(Table2[date],0) && [Lost] =1), [Lost])

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

@amitchandak Thank you massivley! You are a genius!!

Helpful resources

Announcements
Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

October Power BI Update Carousel

Power BI Monthly Update - October 2025

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

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.

Top Solution Authors