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

Power BI is turning 10! Let’s celebrate together with dataviz contests, interactive sessions, and giveaways. Register now.

Reply
BloodBorne
Frequent Visitor

Counting Subscription Users

Hi All,

 

Thanks for your help in advance.

 

This is my dataset below

Customer IDCustomer Registration DateCustomer Subscription DateCustomer Expiration Date
101/05/202401/05/2024 
201/05/202401/05/202401/06/2024
301/05/202401/05/202401/06/2024
402/05/202402/05/202402/05/2025
502/05/202402/05/202402/06/2024
602/05/202402/05/202402/06/2024
702/05/202402/05/202402/06/2024
802/05/202402/05/202402/05/2025
902/05/202402/05/2024 
1003/05/202403/05/2024 
1104/05/202404/05/202404/06/2024
1204/05/202404/05/2024 

 

The blank in the Customer Expiration Date means the subscription is still active.

 

My question is what is the DAX formlua to know the number of ACTIVE subscribers in a given time period. I'd like to use a date range slicer. In other words, if the date range slicer is set between  03/06/2024 - 30/06/2024, the answer should be 7, because only Customer ID 1, 4, 8, 9, 10, 11, 12 have active subscription because their Customer Expiration Date is either after 03/06/2024 or is blank.

Hope this is clear.

 

Thanks again, much appreciated.

 

Kind Regards

 

2 ACCEPTED SOLUTIONS
Anonymous
Not applicable

Hi @BloodBorne ,

 

According to your description, here are my steps you can follow as a solution.

(1) My test data is the same as yours.

(2) We can create a DateSlicer Table.

DateSlicer = CALENDAR(MIN('Table'[Customer Expiration Date]),MAX('Table'[Customer Expiration Date]))

(3) We can create a measure. 

Count = 
var _a= COUNTROWS(FILTER(ALLSELECTED('Table'),'Table'[Customer Expiration Date]>=MIN('DateSlicer'[Date])))
var _b= COUNTROWS(FILTER(ALLSELECTED('Table'),[Customer Expiration Date]=BLANK()))
RETURN _a+_b

(3) Then the result is as follows.

vtangjiemsft_0-1716430154125.png

Best Regards,

Neeko Tang

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

View solution in original post

Anonymous
Not applicable

Hi @BloodBorne ,

 

We can update the DateSlicer table.

DateSlicer = ADDCOLUMNS( CALENDAR(DATE(2024,1,1),DATE(2025,12,31)),"Year",YEAR([Date]),"Month_num",MONTH([Date]),"Month",FORMAT([Date],"mmm"))

Then we can create a measure.

Count2 = 
var _day= EOMONTH(DATE(MAX('DateSlicer'[Year]),MAX('DateSlicer'[Month_num]),1),0)
var _a= COUNTROWS(FILTER(ALLSELECTED('Table'),'Table'[Customer Expiration Date]>=_day))
var _b= COUNTROWS(FILTER(ALLSELECTED('Table'),[Customer Expiration Date]=BLANK()))
RETURN _a+_b

vtangjiemsft_0-1716451587415.png

vtangjiemsft_1-1716451947877.png

As of the last day of June 2024, there were six active users.

 

Best Regards,

Neeko Tang

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

View solution in original post

5 REPLIES 5
Anonymous
Not applicable

Hi @BloodBorne ,

 

According to your description, here are my steps you can follow as a solution.

(1) My test data is the same as yours.

(2) We can create a DateSlicer Table.

DateSlicer = CALENDAR(MIN('Table'[Customer Expiration Date]),MAX('Table'[Customer Expiration Date]))

(3) We can create a measure. 

Count = 
var _a= COUNTROWS(FILTER(ALLSELECTED('Table'),'Table'[Customer Expiration Date]>=MIN('DateSlicer'[Date])))
var _b= COUNTROWS(FILTER(ALLSELECTED('Table'),[Customer Expiration Date]=BLANK()))
RETURN _a+_b

(3) Then the result is as follows.

vtangjiemsft_0-1716430154125.png

Best Regards,

Neeko Tang

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

Hi,

 

Thank you so much. It works perfectly.

 

By the way, is it possible to modify it so that it shows the number of active subscribers for the last day on the month?

I'd like to plot a time series chart.

Month-YrNumber of Active Subscribers
Jan 20245
Feb 20246
Mar 20248
Apr 202410

 

Basically, what's the number of active subscribers on the last day of each month?

 

Thanks again 🙏

Anonymous
Not applicable

Hi @BloodBorne ,

 

We can update the DateSlicer table.

DateSlicer = ADDCOLUMNS( CALENDAR(DATE(2024,1,1),DATE(2025,12,31)),"Year",YEAR([Date]),"Month_num",MONTH([Date]),"Month",FORMAT([Date],"mmm"))

Then we can create a measure.

Count2 = 
var _day= EOMONTH(DATE(MAX('DateSlicer'[Year]),MAX('DateSlicer'[Month_num]),1),0)
var _a= COUNTROWS(FILTER(ALLSELECTED('Table'),'Table'[Customer Expiration Date]>=_day))
var _b= COUNTROWS(FILTER(ALLSELECTED('Table'),[Customer Expiration Date]=BLANK()))
RETURN _a+_b

vtangjiemsft_0-1716451587415.png

vtangjiemsft_1-1716451947877.png

As of the last day of June 2024, there were six active users.

 

Best Regards,

Neeko Tang

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

Thank you so much. Wish I could buy you a drink to show my appreciation. 

BloodBorne_0-1716537892377.png

 

BloodBorne
Frequent Visitor

Any help on this would be appreciated. Thanks

Helpful resources

Announcements
Join our Fabric User Panel

Join our Fabric User Panel

This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.

June 2025 Power BI Update Carousel

Power BI Monthly Update - June 2025

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

June 2025 community update carousel

Fabric Community Update - June 2025

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