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

Get Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Learn more

Reply
abhishek_2593
Helper II
Helper II

Need help to create a measure to calculate total of a specific field name from different columns

Hi,

 

I have a data set for various campaigns, some of which have multiple commercial partners.
How can i write a measure to calculate the total of these columns(commercial clicks) for each commercial partner type?

Data is as follows:

abhishek_2593_0-1737960862978.png
I will need to use this calculated totals to plot in a bar grapgh to show the click and click rates for each partner.

Can someone please advise?

 

1 ACCEPTED SOLUTION
Fowmy
Super User
Super User

@abhishek_2593 

You need to trasnform this data in to a Power Bi friendly format, then use a simple measure like sum(yourtablename[clicks]) and use it with Partners.

 

let
    Source = Excel.CurrentWorkbook(){[Name="Table1"]}[Content],
    #"Removed Columns" = Table.RemoveColumns(Source,{"Total Clicks"}),
    #"Unpivoted Other Columns" = Table.UnpivotOtherColumns(#"Removed Columns", {"Campaign"}, "Attribute", "Value"),
    
    GroupedColumn = Table.AddColumn(#"Unpivoted Other Columns", "Grouped", each if Text.Contains([Attribute], "Clicks") then "Clicks" else "Partner"),
    #"Pivoted Column" = Table.Pivot(GroupedColumn, List.Distinct(GroupedColumn[Grouped]), "Grouped", "Value"),
    #"Filled Down" = Table.FillDown(#"Pivoted Column",{"Partner"}),
    #"Filtered Rows" = Table.SelectRows(#"Filled Down", each ([Clicks] <> null)),
    #"Removed Columns1" = Table.RemoveColumns(#"Filtered Rows",{"Attribute"}),
    #"Changed Type" = Table.TransformColumnTypes(#"Removed Columns1",{{"Clicks", type number}})
in
    #"Changed Type"


After Transformation 

Fowmy_0-1737963457491.png

 

 




Did I answer your question? Mark my post as a solution! and hit thumbs up


Subscribe and learn Power BI from these videos

Website LinkedIn PBI User Group

View solution in original post

2 REPLIES 2
Fowmy
Super User
Super User

@abhishek_2593 

You need to trasnform this data in to a Power Bi friendly format, then use a simple measure like sum(yourtablename[clicks]) and use it with Partners.

 

let
    Source = Excel.CurrentWorkbook(){[Name="Table1"]}[Content],
    #"Removed Columns" = Table.RemoveColumns(Source,{"Total Clicks"}),
    #"Unpivoted Other Columns" = Table.UnpivotOtherColumns(#"Removed Columns", {"Campaign"}, "Attribute", "Value"),
    
    GroupedColumn = Table.AddColumn(#"Unpivoted Other Columns", "Grouped", each if Text.Contains([Attribute], "Clicks") then "Clicks" else "Partner"),
    #"Pivoted Column" = Table.Pivot(GroupedColumn, List.Distinct(GroupedColumn[Grouped]), "Grouped", "Value"),
    #"Filled Down" = Table.FillDown(#"Pivoted Column",{"Partner"}),
    #"Filtered Rows" = Table.SelectRows(#"Filled Down", each ([Clicks] <> null)),
    #"Removed Columns1" = Table.RemoveColumns(#"Filtered Rows",{"Attribute"}),
    #"Changed Type" = Table.TransformColumnTypes(#"Removed Columns1",{{"Clicks", type number}})
in
    #"Changed Type"


After Transformation 

Fowmy_0-1737963457491.png

 

 




Did I answer your question? Mark my post as a solution! and hit thumbs up


Subscribe and learn Power BI from these videos

Website LinkedIn PBI User Group

Thank you for the help @Fowmy  😀

Helpful resources

Announcements
Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

October Power BI Update Carousel

Power BI Monthly Update - October 2025

Check out the October 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.

Top Solution Authors