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.
Hi all,
I am trying to calculate the total value of a subscription which gives me headaches ;).
My data looks like this:
subscription | Startdate line | Einddate line | amount | interval |
A | 1-1-2020 | 31-6-2020 | 200 | Month |
A | 1-7-2020 | 31-12-2020 | 400 | Month |
B | 1-1-2020 | 31-3-2020 | 100 | Quarter |
B | 1-4-2020 | 31-12-2020 | 500 | Quarter |
C | 1-1-2020 | 31-12-2020 | 5000 | Year |
D | 1-1-2020 | 31-12-2020 | 400 | 4 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
Solved! Go to Solution.
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]
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]
Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City
Check out the April 2024 Power BI update to learn about new features.
User | Count |
---|---|
113 | |
99 | |
80 | |
70 | |
59 |
User | Count |
---|---|
149 | |
114 | |
107 | |
89 | |
67 |