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

Get certified in Microsoft Fabric—for free! For a limited time, get a free DP-600 exam voucher to use by the end of 2024. Register now

Reply
nicoenz
Helper III
Helper III

Split revenue per year based to create visual

Hi,

i have a table with 3 columns. "Opportunity name", "12_Month_Revenue" and "Start Operating date". The revenues are always the total for 1 year. If an opportunity starts in September of this year it whould add 4 months to this year and 8 months to next. if it starts in July, it should add 6 and 6 respectively. Note that opportunities can start in any year (2021, 2022, 2023, ..., 2028)

I want to make a visual (like below) that plots per year the annual revenue.

 

nicoenz_0-1718203003572.png

Can you plaese help me? I would really appreciate it!!!

1 ACCEPTED SOLUTION
sevenhills
Super User
Super User

I guess you are doing pro rate by year type of calculations 

 

In Power Query,

 

Query Name "Data Table":

let
    Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("i45WcnRyVtJRMjQyNDYE0mb6hvpGBkbGSrE6CCmwjCVExgQsExAYCBQyMTYyBSmAyJiCZVzcgkAyZqYmIBkDoARIzgwsl5iYiDDP0EjfGGZiLAA=", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [#"Opportunity name" = _t, #"12_Month_Revenue" = _t, #"Start Operating date" = _t]),
    #"Changed Type" = Table.TransformColumnTypes(Source,{{"Opportunity name", type text}, {"12_Month_Revenue", Decimal.Type}, {"Start Operating date", type date}}),
    #"Added Custom" = Table.AddColumn(#"Changed Type", "EOY", each Date.EndOfYear([Start Operating date]), type date),
    #"Added Custom1" = Table.AddColumn(#"Added Custom", "End Operating date", each Date.AddYears([Start Operating date], 1
), type date),
    #"Added Custom2" = Table.AddColumn(#"Added Custom1", "Pro Rate Rev Y1", each [12_Month_Revenue] * (Duration.Days([EOY] - [Start Operating date]))/365.00,  
Decimal.Type),
    #"Inserted Subtraction" = Table.AddColumn(#"Added Custom2", "Pro Rate Rev Y2", each [12_Month_Revenue] - [Pro Rate Rev Y1], Decimal.Type)
in
    #"Inserted Subtraction"

 

sevenhills_0-1718233646315.png

 

Query name "Yearly Data":

let
    Source = #"Data Table",
    #"Removed Columns" = Table.RemoveColumns(Source,{"Opportunity name", "12_Month_Revenue", "EOY", "End Operating date", "Pro Rate Rev Y2"
}),
    #"Renamed Columns" = Table.RenameColumns(#"Removed Columns",{{"Start Operating date", "date"}, {"Pro Rate Rev Y1", "Pro Rate Rev"}}),
    Source1 = #"Data Table",
    #"Removed Columns1" = Table.RemoveColumns(Source1,{"Opportunity name", "12_Month_Revenue", "Start Operating date", "EOY","Pro Rate Rev Y1"}),
    #"Renamed Columns1" = Table.RenameColumns(#"Removed Columns1",{{"End Operating date", "date"}, {"Pro Rate Rev Y2", "Pro Rate Rev"}}),

    Source2 = Table.Combine({#"Renamed Columns", #"Renamed Columns1"}),
    #"Extracted Year" = Table.TransformColumns(Source2,{{"date", Date.Year, Int64.Type}}),
    #"Grouped Rows" = Table.Group(#"Extracted Year", {"date"}, {{"Pro Rate Rev", each List.Sum([Pro Rate Rev]), type number}}),
    #"Renamed Columns2" = Table.RenameColumns(#"Grouped Rows",{{"date", "Year"}})
in
    #"Renamed Columns2"

 

sevenhills_1-1718233702057.png

 

Come back to visualizations (Report)

 

sevenhills_2-1718233765162.png

 

TIA

View solution in original post

1 REPLY 1
sevenhills
Super User
Super User

I guess you are doing pro rate by year type of calculations 

 

In Power Query,

 

Query Name "Data Table":

let
    Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("i45WcnRyVtJRMjQyNDYE0mb6hvpGBkbGSrE6CCmwjCVExgQsExAYCBQyMTYyBSmAyJiCZVzcgkAyZqYmIBkDoARIzgwsl5iYiDDP0EjfGGZiLAA=", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [#"Opportunity name" = _t, #"12_Month_Revenue" = _t, #"Start Operating date" = _t]),
    #"Changed Type" = Table.TransformColumnTypes(Source,{{"Opportunity name", type text}, {"12_Month_Revenue", Decimal.Type}, {"Start Operating date", type date}}),
    #"Added Custom" = Table.AddColumn(#"Changed Type", "EOY", each Date.EndOfYear([Start Operating date]), type date),
    #"Added Custom1" = Table.AddColumn(#"Added Custom", "End Operating date", each Date.AddYears([Start Operating date], 1
), type date),
    #"Added Custom2" = Table.AddColumn(#"Added Custom1", "Pro Rate Rev Y1", each [12_Month_Revenue] * (Duration.Days([EOY] - [Start Operating date]))/365.00,  
Decimal.Type),
    #"Inserted Subtraction" = Table.AddColumn(#"Added Custom2", "Pro Rate Rev Y2", each [12_Month_Revenue] - [Pro Rate Rev Y1], Decimal.Type)
in
    #"Inserted Subtraction"

 

sevenhills_0-1718233646315.png

 

Query name "Yearly Data":

let
    Source = #"Data Table",
    #"Removed Columns" = Table.RemoveColumns(Source,{"Opportunity name", "12_Month_Revenue", "EOY", "End Operating date", "Pro Rate Rev Y2"
}),
    #"Renamed Columns" = Table.RenameColumns(#"Removed Columns",{{"Start Operating date", "date"}, {"Pro Rate Rev Y1", "Pro Rate Rev"}}),
    Source1 = #"Data Table",
    #"Removed Columns1" = Table.RemoveColumns(Source1,{"Opportunity name", "12_Month_Revenue", "Start Operating date", "EOY","Pro Rate Rev Y1"}),
    #"Renamed Columns1" = Table.RenameColumns(#"Removed Columns1",{{"End Operating date", "date"}, {"Pro Rate Rev Y2", "Pro Rate Rev"}}),

    Source2 = Table.Combine({#"Renamed Columns", #"Renamed Columns1"}),
    #"Extracted Year" = Table.TransformColumns(Source2,{{"date", Date.Year, Int64.Type}}),
    #"Grouped Rows" = Table.Group(#"Extracted Year", {"date"}, {{"Pro Rate Rev", each List.Sum([Pro Rate Rev]), type number}}),
    #"Renamed Columns2" = Table.RenameColumns(#"Grouped Rows",{{"date", "Year"}})
in
    #"Renamed Columns2"

 

sevenhills_1-1718233702057.png

 

Come back to visualizations (Report)

 

sevenhills_2-1718233765162.png

 

TIA

Helpful resources

Announcements
November Carousel

Fabric Community Update - November 2024

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

Live Sessions with Fabric DB

Be one of the first to start using Fabric Databases

Starting December 3, join live sessions with database experts and the Fabric product team to learn just how easy it is to get started.

Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount! Early Bird pricing ends December 9th.

Nov PBI Update Carousel

Power BI Monthly Update - November 2024

Check out the November 2024 Power BI update to learn about new features.