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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
power_roboter
Frequent Visitor

Distinctcount relatedtable date_Key to month

Hi experts,

 

I have a table with tracking data [userId, date_Key,..] and a related date table [date_Key, month, year etc.]. The tables are linked via the date_Key. Now I want to calculate the active months of a user.

 

I think calculate(DISTINCTCOUNT(RELATEDTABLE(Date)) does not work, because calculate only refers to one line of a user. The result for this is always 1.

 

Can you help me?

 

 

EVALUATE

DISTINCT (

SELECTCOLUMNS (
FILTER (
'∑ Tracking Data',
'∑ Tracking Data'[Application] = "product_a"
),
"userID", '∑ Tracking Data'[userId],
"numberOfActiveMonths", calculate(DISTINCTCOUNT(RELATEDTABLE(Datum)),
 "numberOfUsageDays", calculate(DISTINCTCOUNT('∑ Tracking Data'[Datum_Key]),ALLEXCEPT('∑ Tracking Data','∑ Tracking Data'[userId]),'∑ Tracking Data'[Datum_Key] >= 20200101)
))

 

2 REPLIES 2

An active user is a user, that has an entry in the tracking table. If the user has an entry for 20200101 he is an active user in january 2020.

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

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

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.

Top Solution Authors