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

Find everything you need to get certified on Fabric—skills challenges, live sessions, exam prep, role guidance, and more. Get started

Reply
demonfc
Employee
Employee

Measure help

I have a problem I am struggling to solve. I have a table with items sold in 4 different columns and the total sales of the item sold in that column in 4 different columns. (See Below). 

 

I need to calculate the total sales of Each item (Bikes, Trains, etc.) regardless of the column its in.

 

For example,"Bikes" is reference in Item column 1, 2, & in column 3 twice, thus would need to sum the values in Value column 1 (Row 2, "556"), Value column 2(row 3, "3815"), and Value Column 3(row 4 "2546" & row 6 "644") to See "Bikes" = 7561. 

 

This would need to be done for Each of the items sold. 

 

Item 1Item 2Item 3Item 4Value 1Value 2Value 3Value 4
BikesTrains  5561600  
TrainsBikesWheels 198638152065 
WheelsSpokesBikesTrains264846254616000
SpokesWheels  11298  
DiamondsRivetsBikes 256645644 
RivetsBikesTraomsWheels64482344522051785

 

Thank you for any help you can provide. 

1 ACCEPTED SOLUTION
Zubair_Muhammad
Community Champion
Community Champion

@demonfc

 

I think you will be better off transforming our table into 2 columns (items and Values) using Power Query

File attached as well

 

let
    Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("ZY7BDsIgEER/peHcA9BdpFfjF6iJB8KhiSQSbWnU+P2yKKtND+xsyLyZdU5s4zU8RCuO9yFOtDTfh2jyVEZK/vSt+/kqeLqEcKug6i1RnVWYRUuDDLLvMKcPuarWBmwWoAiNUPtl4RnjoNqpyN7bxZm7OIxpOpNtH1/h+d/XlHhKN4BlAnMrcz4ujYvabKcu3UGhtZYkamNReP8G", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type text) meta [Serialized.Text = true]) in type table [#"Item 1" = _t, #"Item 2" = _t, #"Item 3" = _t, #"Item 4" = _t, #"Value 1" = _t, #"Value 2" = _t, #"Value 3" = _t, #"Value 4" = _t]),
    step = Table.TransformColumnTypes(Source,{{"Item 1", type text}, {"Item 2", type text}, {"Item 3", type text}, {"Item 4", type text}, {"Value 1", Int64.Type}, {"Value 2", Int64.Type}, {"Value 3", Int64.Type}, {"Value 4", Int64.Type}}),
    G1 = Table.FromColumns({step[Item 1],step[Value 1]},{"Items","Value"}),
    G2 = Table.FromColumns({step[Item 2],step[Value 2]},{"Items","Value"}),
    G3 = Table.FromColumns({step[Item 3],step[Value 3]},{"Items","Value"}),
    G4 = Table.FromColumns({step[Item 4],step[Value 4]},{"Items","Value"}),
    Final=Table.Combine({G1,G2,G3,G4}),
    #"Filtered Rows" = Table.SelectRows(Final, each ([Items] <> " ") and ([Value] <> null))
in
    #"Filtered Rows"

Regards
Zubair

Please try my custom visuals

View solution in original post

1 REPLY 1
Zubair_Muhammad
Community Champion
Community Champion

@demonfc

 

I think you will be better off transforming our table into 2 columns (items and Values) using Power Query

File attached as well

 

let
    Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("ZY7BDsIgEER/peHcA9BdpFfjF6iJB8KhiSQSbWnU+P2yKKtND+xsyLyZdU5s4zU8RCuO9yFOtDTfh2jyVEZK/vSt+/kqeLqEcKug6i1RnVWYRUuDDLLvMKcPuarWBmwWoAiNUPtl4RnjoNqpyN7bxZm7OIxpOpNtH1/h+d/XlHhKN4BlAnMrcz4ujYvabKcu3UGhtZYkamNReP8G", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type text) meta [Serialized.Text = true]) in type table [#"Item 1" = _t, #"Item 2" = _t, #"Item 3" = _t, #"Item 4" = _t, #"Value 1" = _t, #"Value 2" = _t, #"Value 3" = _t, #"Value 4" = _t]),
    step = Table.TransformColumnTypes(Source,{{"Item 1", type text}, {"Item 2", type text}, {"Item 3", type text}, {"Item 4", type text}, {"Value 1", Int64.Type}, {"Value 2", Int64.Type}, {"Value 3", Int64.Type}, {"Value 4", Int64.Type}}),
    G1 = Table.FromColumns({step[Item 1],step[Value 1]},{"Items","Value"}),
    G2 = Table.FromColumns({step[Item 2],step[Value 2]},{"Items","Value"}),
    G3 = Table.FromColumns({step[Item 3],step[Value 3]},{"Items","Value"}),
    G4 = Table.FromColumns({step[Item 4],step[Value 4]},{"Items","Value"}),
    Final=Table.Combine({G1,G2,G3,G4}),
    #"Filtered Rows" = Table.SelectRows(Final, each ([Items] <> " ") and ([Value] <> null))
in
    #"Filtered Rows"

Regards
Zubair

Please try my custom visuals

Helpful resources

Announcements
Europe Fabric Conference

Europe’s largest Microsoft Fabric Community Conference

Join the community in Stockholm for expert Microsoft Fabric learning including a very exciting keynote from Arun Ulag, Corporate Vice President, Azure Data.

Power BI Carousel June 2024

Power BI Monthly Update - June 2024

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

PBI_Carousel_NL_June

Fabric Community Update - June 2024

Get the latest Fabric updates from Build 2024, key Skills Challenge voucher deadlines, top blogs, forum posts, and product ideas.

RTI Forums Carousel3

New forum boards available in Real-Time Intelligence.

Ask questions in Eventhouse and KQL, Eventstream, and Reflex.

Top Solution Authors