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
apmulhearn
Helper III
Helper III

Need Help Returning a Value Based on Contact ID Match and Date Filter Between Two Tables

Hi!

I have two tables - one with Queries by guests, one with Sales to guests.

 

I need to be able to count, within a given date range, how many Queries converted to Sales.

If a Sale date is BEFORE a Query date, that Sale does not count for the given query.

In the Sample provided, I am looking for the answer '5.'

apmulhearn_0-1665022307591.png


Thank you!
Amanda

2 REPLIES 2
amitchandak
Super User
Super User

@apmulhearn ,

Try a measure like

 

Sumx(Table1,

var _cnt = count(Filter(Table2, Table1[Contact ID] = Table2[ContactID] && Table2[Date] > Table1[Date]), Table2[Date])

return

_cnt)

 

Plot with columns from Table 1 columns

Join us as experts from around the world come together to shape the future of data and AI!
At the Microsoft Analytics Community Conference, global leaders and influential voices are stepping up to share their knowledge and help you master the latest in Microsoft Fabric, Copilot, and Purview.
️ November 12th-14th, 2024
 Online Event
Register Here

Hi @amitchandak , and thank you for this explanation...
When I get to the red part from your sample formula (repasted below) I am unable to add a table name - I can only add an existing measure. Do you have any suggestions for what I might look at? 

Sumx(Table1,

var _cnt = count(Filter(Table2, Table1[Contact ID] = Table2[ContactID] && Table2[Date] > Table1[Date]), Table2[Date])

return

_cnt)



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.