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

Be one of the first to start using Fabric Databases. View on-demand sessions with database experts and the Microsoft product team to learn just how easy it is to get started. Watch now

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
amitchandak
Super User
Super User

@power_roboter , not clear on what is an active user.

 

Is it very similar to

new vs repeat customer
https://community.powerbi.com/t5/Desktop/Churn-Rate-lost-Customer/m-p/1173754#M529196
https://blog.enterprisedna.co/new-vs-existing-customers-advanced-analytics-w-dax/
https://www.sqlbi.com/articles/computing-new-customers-in-dax/

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

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
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!

ArunFabCon

Microsoft Fabric Community Conference 2025

Arun Ulag shares exciting details about the Microsoft Fabric Conference 2025, which will be held in Las Vegas, NV.

December 2024

A Year in Review - December 2024

Find out what content was popular in the Fabric community during 2024.