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

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

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
Power BI DataViz World Championships

Power BI Dataviz World Championships

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!

November Power BI Update Carousel

Power BI Monthly Update - November 2025

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

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.