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

Don't miss out! 2025 Microsoft Fabric Community Conference, March 31 - April 2, Las Vegas, Nevada. Use code MSCUST for a $150 discount. Prices go up February 11th. Register now.

Reply
Praj
Helper I
Helper I

DAX measure to calculate users who are active at the selected timeframe

Hey Everyone,

 

I am trying to calculate the % of users who had an event and had an active membership during the selected timeframe. For example, I have below two tables.

 

1) Membership Info - Table about when a member joined the membership

Praj_0-1709030650809.png 

2) Event Info - Table when a member had an event

Praj_1-1709030691451.png

 

I want to calulate the % of member who had an event and were active at the selected timeframe using the below slicer. Say, If my user selects April and May in the slicer, the output should be 100% because at the end of May, 3 users had event and their membership start date was before May. Similarly, If my user select July, the output should be 25% as only 1 user had en event in July and by the end of July we had 4 users whose membership start date was <= 31st of July 

Praj_3-1709030893376.png

 

I am able to get the distinct user who had an event (i,e I am able to get the right number for numerator) however, facing error with denominator. I did write the below code but with incorrect result

Measure = 
var selected_date = SELECTEDVALUE(Sheet2[Event Date])
var memberswithmemship =
    CALCULATETABLE(
        VALUES(Sheet1[User ID]),
        Sheet1[Membership Date] <= selected_date
    )
return COUNTROWS(memberswithmemship)

 

If anyone had similar usecase or anyone know a possible solution/approach I would be really grateful if you share the same. 

 

Thanks in advance

 

Praj

 

3 REPLIES 3
Praj
Helper I
Helper I

Hi @lbendlin , 

 

Thanks for your response. Below is the sample data as provided in the screenshot.  I am trying to calulate the % of members who had an event and were part of membership at the selected timeframe.Say, If my user selects April and May in the slicer, the output should be 100% because at the end of May, 3 users had event and their membership start date was before May. Similarly, If my user select July, the output should be 25% as only 1 user had en event in July and by the end of July we had 4 users whose membership start date was <= 31st of July 

 

Membership Info Table 

User IDMembership Date
101-Jan-22
201-Jan-22
301-Apr-22
401-Jun-22
701-Aug-22
501-Sep-22
601-Sep-22
801-Oct-22
901-Nov-22
1001-Dec-22

 

Event Info

User IDEvent Date
101-Apr-22
201-Apr-22
305-Apr-22
101-May-22
401-Jul-22
501-Oct-22
505-Oct-22
805-Oct-22
909-Dec-22
1009-Dec-22

your sample data is not covering your scenarios well.

 

lbendlin_0-1709164104891.png

 

lbendlin
Super User
Super User

Please provide sample data that covers your issue or question completely, in a usable format (not as a screenshot).

Do not include sensitive information or anything not related to the issue or question.

If you are unsure how to upload data please refer to https://community.fabric.microsoft.com/t5/Community-Blog/How-to-provide-sample-data-in-the-Power-BI-...

Please show the expected outcome based on the sample data you provided.

Want faster answers? https://community.fabric.microsoft.com/t5/Desktop/How-to-Get-Your-Question-Answered-Quickly/m-p/1447...

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!

Jan25PBI_Carousel

Power BI Monthly Update - January 2025

Check out the January 2025 Power BI update to learn about new features in Reporting, Modeling, and Data Connectivity.

December 2024

A Year in Review - December 2024

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