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
eOfer
New Member

Add DATESBETWEEN measure based on 2 date columns

Hi,

How do i add a Subscriber measure based on valid dates per period between Effective_Date and Expiration_Date?

Thanks!

 

DATESBETWEEN.jpg

1 ACCEPTED SOLUTION

9 REPLIES 9
Phil_Seamark
Employee
Employee

Hi @eOfer

 

What would your expected result be for the top row where Subscriber is 0528889991?


To learn more about DAX visit : aka.ms/practicalDAX

Proud to be a Datanaut!

Hi @Phil_Seamark,

The aim of my question is to show a tendency of active subscribers per chosen period.

If 0528889991 is within the chosen period - count it and display on the graph.

 

HI @eOfer

 

Do you want to plot daily, weekly or monthly usage?


To learn more about DAX visit : aka.ms/practicalDAX

Proud to be a Datanaut!

Monthly

and one last request,  Any chance you can paste your sample data here to save me typing it all in 🙂


To learn more about DAX visit : aka.ms/practicalDAX

Proud to be a Datanaut!

Sure, 

Here's a sample:

SubscriberService_codeEffective_DateExpiration_Date
0528889991ABC1/1/20173/8/2017
0528889992DEF5/1/2017 
0528889993CCC3/1/20185/26/2018
0528889994ABC3/24/20186/1/2018
0528889995DEF1/30/2017 
0528889996XYZ2/4/20174/29/2017
0528889997ABC6/4/20178/29/2017
0528889998BBB4/4/2018 
0528889999XYZ4/27/20186/28/2018
0528890000ABC3/4/20175/21/2017
0528890001DEF3/9/2017 
0528890002XYZ7/8/201710/2/2017
0528890003AAA5/8/2018 
0528890004DEF5/31/2018 
0528890005CCC4/7/20177/6/2017
0528890006ABC4/12/20177/12/2017
0528890007BBB8/11/201711/7/2017
0528890008XYZ6/11/2018 
0528890009ABC7/4/20189/12/2018
0528890010DEF5/11/2017 
0528890011XYZ5/16/20177/20/2017
0528890012ABC9/14/201712/2/2017
0528890013DEF7/15/20189/26/2018

Hi @eOfer

 

I created the following calculated table using this code, and have attached a PBIX file that uses your sample data.

 

 

Expanded Table = 
var myMonths = SUMMARIZE(ADDCOLUMNS( CALENDARAUTO(),"Month",DATEVALUE(FORMAT([Date],"1-MMM-YYYY"))),[Month])
RETURN 
    GENERATE(
        'Table1',
        FILTER(
            myMonths,
            [Month]>=[Effective_Date] && [Month] < IF(ISBLANK([Expiration_Date]),DATE(2099,1,1),[Expiration_Date])
            )
            
            )

image.png


To learn more about DAX visit : aka.ms/practicalDAX

Proud to be a Datanaut!

Thanks a lot @Phil_Seamark!

Awesome!

Hi Guys,

I'm trying to figure out from the table how many active subscribers do i have between start date (Effective_Date) and present day, considering their formal end date (Expiration_Date). 

Any thoughts will be much appreciated!

Thanks,

Ofer Eavri

Active UsersActive Users 

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.