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
triggerturf
Frequent Visitor

Evaluate whether membership is active on a certain date

Hi,

I am working on a membership database where I would like to look at how many active members there were on a certain date in the past.

 

A member may have had different contracts over the course of time, meaning that they have been active in several, separeted periods of time. So the data looks something like this:

 

CustomerContractContractStartDateContractEndDate
A113.01.201418.06.2014
A221.09.201417.12.2014
B315.12.201429.12.2014
B418.01.201526.05.2016

 

This will eventually lead to cohort analysis, but for the time being I'd be happy to see how many active customers we had on, say, 16.12.2014, and what their names were.

 

The problem is creating the measure that will tell me if the customer had an active contract at the given date.... Any suggestions?

1 ACCEPTED SOLUTION
MFelix
Super User
Super User

Hi @triggerturf,

 

Add a calendar table to your model, then add the following measure to your table:

Active/Inactive =
VAR CalendarDate =
    MAX ( 'Calendar'[Date] )
RETURN
    IF (
        CalendarDate >= MAX ( Membership[ContractStartDate] )
            && CalendarDate <= MAX ( Membership[ContractEndDate] ),
        "Active",
        "Inactive"
    )

See the result below:

Dates_selector.gif

Regards,

MFelix


Regards

Miguel Félix


Did I answer your question? Mark my post as a solution!

Proud to be a Super User!

Check out my blog: Power BI em Português



View solution in original post

6 REPLIES 6
triggerturf
Frequent Visitor

Update; Suggested solution works when removing existing / misleading relationships from model. Simply made new pbix based on existing data model to handle this challenge.

v-ljerr-msft
Employee
Employee

Hi @triggerturf,

 

Could you post your table structures(including the relationships) with some sample/mock data, so that we can further assist on this issue? Smiley Happy

 

Regards

Thanks for offering, but due to the nature of person data and legislation it seems I would have to build a full mockup with sample data, which would take too much time right now (12 tables with total 11 active and 3 passive relationships).

 

I will try to get at the challenge from a different angle.

MFelix
Super User
Super User

Hi @triggerturf,

 

Add a calendar table to your model, then add the following measure to your table:

Active/Inactive =
VAR CalendarDate =
    MAX ( 'Calendar'[Date] )
RETURN
    IF (
        CalendarDate >= MAX ( Membership[ContractStartDate] )
            && CalendarDate <= MAX ( Membership[ContractEndDate] ),
        "Active",
        "Inactive"
    )

See the result below:

Dates_selector.gif

Regards,

MFelix


Regards

Miguel Félix


Did I answer your question? Mark my post as a solution!

Proud to be a Super User!

Check out my blog: Power BI em Português



I see what is being done here, but I think that I getting stuck by a number of existing relationships to various tables in our data model. I have a feeling I have to extract some data/colums to a table without relationships to make this work, but it's outside my comfort zone / level of knowledge 🙂

Don't know how you model is setup but if you have a sample data or some explanation on how you have your model I can try an help you.

 

Regards,

MFelix


Regards

Miguel Félix


Did I answer your question? Mark my post as a solution!

Proud to be a Super User!

Check out my blog: Power BI em Português



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.