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
BobKoenen
Helper IV
Helper IV

Calculate the total value of a subscription

Hi all,

 

I am trying to calculate the total value of a subscription which gives me headaches ;). 

My data looks like this:

 

subscriptionStartdate lineEinddate lineamountinterval
A1-1-202031-6-2020200Month
A1-7-202031-12-2020400Month
B1-1-202031-3-2020100Quarter
B1-4-202031-12-2020500Quarter
C1-1-202031-12-20205000Year
D1-1-202031-12-20204004 weekly 

 

The output should give me

A = (6* 200) + 6*(400) = 3600

B = 100 + (3*500) = 1600

C = 5000
D = (52/4) * 400)

 

I hope you can help me

 

1 ACCEPTED SOLUTION
Mariusz
Community Champion
Community Champion

Hi @BobKoenen 

 

You can create a column like.

Column = 
SWITCH(
    'Table'[interval],
    "Month", DATEDIFF( 'Table'[Startdate line], 'Table'[Einddate line], MONTH ) +1,
    "Quarter", DATEDIFF( 'Table'[Startdate line], 'Table'[Einddate line], QUARTER ) +1,
    "Year", DATEDIFF( 'Table'[Startdate line], 'Table'[Einddate line], MONTH ) +1, 
    "4 weekly", ( DATEDIFF( 'Table'[Startdate line], 'Table'[Einddate line], WEEK ) + 1 ) /4
) * 'Table'[amount]

 

Best Regards,
Mariusz

If this post helps, then please consider Accepting it as the solution.

Please feel free to connect with me.
LinkedIn

 

View solution in original post

1 REPLY 1
Mariusz
Community Champion
Community Champion

Hi @BobKoenen 

 

You can create a column like.

Column = 
SWITCH(
    'Table'[interval],
    "Month", DATEDIFF( 'Table'[Startdate line], 'Table'[Einddate line], MONTH ) +1,
    "Quarter", DATEDIFF( 'Table'[Startdate line], 'Table'[Einddate line], QUARTER ) +1,
    "Year", DATEDIFF( 'Table'[Startdate line], 'Table'[Einddate line], MONTH ) +1, 
    "4 weekly", ( DATEDIFF( 'Table'[Startdate line], 'Table'[Einddate line], WEEK ) + 1 ) /4
) * 'Table'[amount]

 

Best Regards,
Mariusz

If this post helps, then please consider Accepting it as the solution.

Please feel free to connect with me.
LinkedIn

 

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.