This is best Fabric, Power BI, SQL and AI community event. How do we know? The last event sold out! Save €200 with code FABCMTY200.
Register nowA new Data Days event is coming soon! This time we’re going bigger than ever. Fabric, Power BI, SQL, AI and more. Don't miss out.
Hello all,
I am attempting to create a calculated column that does a distinct count within another table. I have a subscriptions table that holds a customer id and a start and end date. There is a second table, usage, that holds the customer id, a user id, and a date for when an action was completed. I am trying to set up a column in the subscriptions table that uses the customer id in each table, filters the usage table to be greater than the start date but less than the end date in the subscriptions table, and does a distinct count of the user id’s.
Subscriptions
Usage
Result
For customer 123-456, 2 would be returned because user 'abc' and 'def' both had a record with a date between 1/1/2022 and 1/1/2023. For customer 789-101, 2 is returned because only 2 distinct users had a record in the time frame of 6/1/2022 - 6/1/2023. User 'zxy' was not within this time frame.
Any assistance with this would be greatly appreciated, thanks!
Solved! Go to Solution.
@arhomberg - This seems to work:
Column =
SUMMARIZE (
FILTER (
Usage,
Usage[customer_id] = Subscriptions[customer_id]
&& Usage[date] >= Subscriptions[start_date]
&& Usage[date] <= Subscriptions[end_date]
),
"@", DISTINCTCOUNT ( Usage[user_id] )
)
Proud to be a Super User!
1. Use the related function to add your start and end date into your subscriptions table.
2. Create a new calculated column in your subscriptions column to check if the salesdate is between the start and end. like this:
@arhomberg - This seems to work:
Column =
SUMMARIZE (
FILTER (
Usage,
Usage[customer_id] = Subscriptions[customer_id]
&& Usage[date] >= Subscriptions[start_date]
&& Usage[date] <= Subscriptions[end_date]
),
"@", DISTINCTCOUNT ( Usage[user_id] )
)
Proud to be a Super User!
I was able to solve this with the following:
Check out the May 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 |
|---|---|
| 27 | |
| 26 | |
| 22 | |
| 19 | |
| 17 |
| User | Count |
|---|---|
| 42 | |
| 42 | |
| 41 | |
| 21 | |
| 20 |