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
Matjo
Advocate I
Advocate I

Handling revenue from subscription with a date range on a monthly basis

Hi, 

I have some data with subscription where the subscription can start at the beginning or the middle of the month.

So it could look like this. 

Company   Monthly_fee start_date       end_date
1337ltd             99          2015-02-14    2017-03-31

I would like to be able to slice this income on a monthly basis so if I would filter for January 2017 I would get $99 as revenue for this company, the revenue for february 2015 should be $49.5. 

My initial thought was to create additional columns and pivot them to get an entry for each month but since the contracts can start in the middle of the month that does not work. 

Any ideas how this can be handled in an elegant way?


Best regards!


1 ACCEPTED SOLUTION

Hi @Matjo,

 

The time is interval in your data model. If you want to filter the dates, the dates in the interval will be missed. So a date table is necessary.

1. Create a date table.

Calendar =
CALENDARAUTO ()

2. Join the date table and your data table.

Table =
FILTER (
    CROSSJOIN ( 'Table1', FILTER ( 'Calendar', DAY ( [Date] ) = 1 ) ),
    [Date]
        >= [Start_Date] - 31
        && [Date] <= [End_Date]
)

3. Add a Calculated Column.

Fee = if([Date]=[Start_Date],[Monthly_Fee],
if([Start_Date].[Year]=[Date].[Year]&&[Start_Date].[Month]=[Date].[Month],[Monthly_Fee]/2,
if([End_Date]=EOMONTH([Date],0),[Monthly_Fee],
if([End_Date].[Year]=[Date].[Year]&&[End_Date].[Month]=[Date].[Month], [Monthly_Fee]/2,[Monthly_Fee]))))

4. Create a visual, you can try it in this file: https://1drv.ms/u/s!ArTqPk2pu-BkgS4V8tw_INyjXVE1Handling revenue from subscription with a date range on a monthly basis.jpg

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

Best Regards!

Dale

Community Support Team _ Dale
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

7 REPLIES 7
KHorseman
Community Champion
Community Champion

Can you give some details on the rules for how the fee is prorated? Is it reduced by the percentage of a month they are subscribed, is it like a tiered thing where for instance if they are subscribed for less than 3 weeks they get 50% of the fee, etc?





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

Proud to be a Super User!




If the subscription starts or ends in the middle of a month the fee for that month is 50% so $49.5.

 

if a subscription looked like this: 
CompanyA $99 15/1/2017 15/3/2017 
I would like to see:
$49.5 revenue for january

$99 revenue for february

$49.5 revenue for march


KHorseman
Community Champion
Community Champion

Yeah I get that example. I guess what I'm asking is what happens if they subscribe on February 21st or February 8th? Still 50% for both of them?





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

Proud to be a Super User!




Ah, sorry. They can sign on whenever they want but it will either be recorded as the beginning or the middle of the month. 
So it the start date in the table will be 1st or 15th and the end date can be 28th, 29th, 30th or 31st depending on the month. 

KHorseman
Community Champion
Community Champion

So then what's the rule exactly? If they sign up on or before the 15th it's 50%, and if they sign up any date after the 15th it's 100%?





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

Proud to be a Super User!




The rule is if they sign on day 1-15 their subscription will start on the 15th, if the sign on 15-31 their subscription will start the 1st. If they cancel day 1-15 the end date will be 15 otherwise the end of the month. 


Hi @Matjo,

 

The time is interval in your data model. If you want to filter the dates, the dates in the interval will be missed. So a date table is necessary.

1. Create a date table.

Calendar =
CALENDARAUTO ()

2. Join the date table and your data table.

Table =
FILTER (
    CROSSJOIN ( 'Table1', FILTER ( 'Calendar', DAY ( [Date] ) = 1 ) ),
    [Date]
        >= [Start_Date] - 31
        && [Date] <= [End_Date]
)

3. Add a Calculated Column.

Fee = if([Date]=[Start_Date],[Monthly_Fee],
if([Start_Date].[Year]=[Date].[Year]&&[Start_Date].[Month]=[Date].[Month],[Monthly_Fee]/2,
if([End_Date]=EOMONTH([Date],0),[Monthly_Fee],
if([End_Date].[Year]=[Date].[Year]&&[End_Date].[Month]=[Date].[Month], [Monthly_Fee]/2,[Monthly_Fee]))))

4. Create a visual, you can try it in this file: https://1drv.ms/u/s!ArTqPk2pu-BkgS4V8tw_INyjXVE1Handling revenue from subscription with a date range on a monthly basis.jpg

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

Best Regards!

Dale

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

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.