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

Find everything you need to get certified on Fabric—skills challenges, live sessions, exam prep, role guidance, and more. Get started

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
Sept PBI Carousel

Power BI Monthly Update - September 2024

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

September Hackathon Carousel

Microsoft Fabric & AI Learning Hackathon

Learn from experts, get hands-on experience, and win awesome prizes.

Sept NL Carousel

Fabric Community Update - September 2024

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