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

Compete to become Power BI Data Viz World Champion! First round ends August 18th. Get started.

Reply
Alex1988
Helper I
Helper I

Count of active Subscriptions (using their start & end dates) during any calendar filtration

Hi Guys, 

 

We have a aggregate table of subscribers grouped into their common start dates and end dates. We want to be able to have one measure that, irrespective of which date dimension being used in the chart it, could count the number of active subscriptions. Active meaning that their subscription had not ended before the start of the date range (their end date can be within the date range) 

Below is what we are using at the moment - but I'm pretty sure when we use this Measure on anything other than [Date] it calculates incorrectly. I would like a measure that would do this even if [month]/[week]/[quarter] .etc is selected. 

 

-----------------------------------------------------------------------------------------------------

Subscriber Base =
 
var __periodStart = MIN ('Date'[Date] )
var __accCount =
    CALCULATE(
        SUM(Subscriptions[SubscriberCount]),
        Subscriptions[Start Date] <= __periodStart,
IF(ISBLANK(Subscriptions[End Date]),TODAY(),Subscriptions[End Date]) >= __periodStart
    )
return
    __accCount
 
------------------------------------------------------------------------------------------------------------------
3 REPLIES 3
v-alq-msft
Community Support
Community Support

Hi, @Alex1988 

 

Based on your description, I created data to reproduce your scenario. The pbix file is attached in the end.

 

Table:

c1.png

 

Calendar(a calculated table):

Calendar = CALENDARAUTO()

 

There is no relationship between two tables. You may create a measure as below.

Subscriber Base = 
var _minperiod = CALCULATE(MIN('Calendar'[Date]),ALLSELECTED('Calendar'))
var _maxperiod = CALCULATE(MAX('Calendar'[Date]),ALLSELECTED('Calendar'))
var tab = 
ADDCOLUMNS(
    'Table',
    "Flag",
    IF(
        NOT(
            OR(
                [End Date]<_minperiod,
                [Start Date]>_maxperiod
            )
        ),
        1,0
    )
)
return
SUMX(
     FILTER(
         tab,
         [Flag]=1
     ),
     [SubscriberCount]
)

 

Finally you may use the 'Date' column from 'Calendar' table to filter the result.

c2.png

 

Best Regards

Allan

 

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

 

 

Pragati11
Super User
Super User

HI @Alex1988 ,

 

There is an existing thread for this:

https://community.powerbi.com/t5/Desktop/Get-active-employee-count-based-on-start-and-end-date-range...

 

Thanks,

Pragati

Best Regards,

Pragati Jain


MVP logo


LinkedIn | Twitter | Blog YouTube 

Did I answer your question? Mark my post as a solution! This will help others on the forum!

Appreciate your Kudos!!

Proud to be a Super User!!

amitchandak
Super User
Super User

@Alex1988 , refer if this blog can help

https://community.powerbi.com/t5/Community-Blog/HR-Analytics-Active-Employee-Hire-and-Termination-tr...

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

Helpful resources

Announcements
August Power BI Update Carousel

Power BI Monthly Update - August 2025

Check out the August 2025 Power BI update to learn about new features.

August 2025 community update carousel

Fabric Community Update - August 2025

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

Top Solution Authors