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

Level up your Power BI skills this month - build one visual each week and tell better stories with data! Get started

Reply
LowisC
Regular Visitor

Measure to calculate the number of results in Table 2, filtering by Table 2 date >= Table 1 date

Hello,

I would really appreciate if anyone could give me a hand on figuring out how I can solve the following:

 

I have Table 1 and Table 2 with a relation of many to many created. They are both connected throught "Document Number" column. I use Table 1 as my main table. Both tables show workflows information, meaning that I may have several rows with the same Document Number but with other different information, like Task Completion Date (Table 1) and/or Workflow Completion Date (Table 2), for example.

 

Based on their relation, when I filter Table 1 by Task Completion Date, Table 2 will show all the workflows containing the same Document Numbers filtered in Table 1.

 

I would like to come up with a measure that I could apply in a visual card that would calculate the total number of  results in "Document Number" column in Table 2 (not a distinct count), but only the results that comply with the following:

 

- Workflow Completion Date (Table 2) >= Task Completion Date (Table 1)

 

Is this possible? Let me know if I need to provide any further clarification.

 

Thanks in advance.

1 ACCEPTED SOLUTION
amitchandak
Super User
Super User

@LowisC , Try a measure like

 

Sumx(Table2, Countx(filter(Table2, Table1[Task Completion Date] <= Table2[Workflow Completion Date] && Table1[Document Number] = Table2[Document Number]),Table2[Document Number]))

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
LowisC
Regular Visitor

Many thanks for your prompt reply @amitchandak 

amitchandak
Super User
Super User

@LowisC , Try a measure like

 

Sumx(Table2, Countx(filter(Table2, Table1[Task Completion Date] <= Table2[Workflow Completion Date] && Table1[Document Number] = Table2[Document Number]),Table2[Document Number]))

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

Helpful resources

Announcements
April Power BI Update Carousel

Power BI Monthly Update - April 2026

Check out the April 2026 Power BI update to learn about new features.

Fabric SQL PBI Data Days

Data Days 2026 coming soon!

Sign up to receive a private message when registration opens and key events begin.

New to Fabric survey Carousel

New to Fabric Survey

If you have recently started exploring Fabric, we'd love to hear how it's going. Your feedback can help with product improvements.

Power BI DataViz World Championships carousel

Power BI DataViz World Championships - June 2026

A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.