This time we’re going bigger than ever. Fabric, Power BI, SQL, AI and more. We're covering it all. You won't want to miss it.
Learn moreLevel up your Power BI skills this month - build one visual each week and tell better stories with data! Get started
Hi ,
I need help with the following attached file.
I want to calculate conversion for each route_id for the two calendar years of 2021 and 2022 based on following condition:
1. The contact_id should be matching in the two tables activity and payment
2. The payment date should be after activity datetime and should be within 15 days of the activity datetime
3. activity[status] should be "read"
4. There are multiple "read" for each route_id and only the newest datetime of "read" should be considered
I've created a measure as following
ConversionCount =
VAR _journey = CALCULATETABLE(VALUES(activity[contact_id]),activity[status] = "read")
VAR _education = VALUES(payment[contact_id])
RETURN
IF(MAX(activity[datetime]) <= MAX(payment[date]) && (MAX(activity[datetime]) +15) >= MAX(payment[date]),COUNTROWS(DISTINCT(INTERSECT(_education,_journey))))
But it is not giving the output correctly as seen in the page titled Cross_check where the count is shown as 669 of total conversion but if i export the table and do a manual row count it comes to 618 and there are duplicate contact_ids as well which shouldn't be counted. If i only do a manual count of distinct contact_id in the exported table it comes to 417
I want the final output as mentioned in the page Desired output.
Solved! Go to Solution.
Hi @Anonymous ,
Maybe you can try this code:
Measured =
VAR _1 =
SUMMARIZE (
FILTER ( 'activity', [status] = "read" ),
[contact_id],
"newest", MAX ( 'activity'[datetime] ),
"pt", MAX ( 'payment'[date] )
)
VAR _2 =
FILTER (
ADDCOLUMNS (
_1,
"if in",
IF ( [newest] <= [pt] && [pt] <= [newest] + 15, 1, 0 )
),
[if in] = 1
)
RETURN
COUNTROWS(_2)
Pbix in the end you can refer.
Best Regards
Community Support Team _ chenwu zhu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Hi @Anonymous ,
Maybe you can try this code:
Measured =
VAR _1 =
SUMMARIZE (
FILTER ( 'activity', [status] = "read" ),
[contact_id],
"newest", MAX ( 'activity'[datetime] ),
"pt", MAX ( 'payment'[date] )
)
VAR _2 =
FILTER (
ADDCOLUMNS (
_1,
"if in",
IF ( [newest] <= [pt] && [pt] <= [newest] + 15, 1, 0 )
),
[if in] = 1
)
RETURN
COUNTROWS(_2)
Pbix in the end you can refer.
Best Regards
Community Support Team _ chenwu zhu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Hi,
Can someone please help?
To all the experts, please help.
Check out the April 2026 Power BI update to learn about new features.
Sign up to receive a private message when registration opens and key events begin.
If you have recently started exploring Fabric, we'd love to hear how it's going. Your feedback can help with product improvements.
| User | Count |
|---|---|
| 36 | |
| 28 | |
| 28 | |
| 20 | |
| 18 |
| User | Count |
|---|---|
| 65 | |
| 35 | |
| 34 | |
| 25 | |
| 24 |