Advance your Data & AI career with 50 days of live learning, dataviz contests, hands-on challenges, study groups & certifications and more!
Get registeredGet Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Learn more
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:
Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!
Check out the October 2025 Power BI update to learn about new features.