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
Anonymous
Not applicable

Sums row data / substrate and new table

Hi, 

I have two set of data 

Data1 : Total used 

TimestampValue
5/6/2250
5/6/2250
7/6/2260
7/6/2270
7/6/2280

 

Data 2: Each stream

TimestampStreamValue
5/6/22110
5/6/22120
7/6/22123
7/6/22120
7/6/22150
5/6/22215
5/6/22215
7/6/22215
7/6/2226
7/6/22220

 

The output table should be Stream 3. Value = total -stream 1-stream 2

Timestamp Value
5/6/2240
7/6/2276

 

Thanks for your help. Really appreciate it. 

1 ACCEPTED SOLUTION
jbwtp
Memorable Member
Memorable Member

Hi @Anonymous,

 

Something like this:

let
    Streams = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("i45WMtU3MNM3MjAyUtJRMgRhA6VYHUxhI4iwObqwMXZh7KpNMc0GS5niEzYnTtgMqyjIIbEA", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [Timestamp = _t, Stream = _t, Value = _t]),
    Totals = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("i45WMtU3MNM3MjAyUtJRMjVQitXBKmSOJGSGKWSOKWQBFIoFAA==", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [Timestamp = _t, Value = _t]),
    ReverseSignonStreams = Table.TransformColumns(Streams, {"Value", each Number.From(_) * -1}),
    Combine = Table.Combine({Totals, ReverseSignonStreams}),
    #"Changed Type" = Table.TransformColumnTypes(Combine,{{"Value", type number}}),
    Output = Table.Group(#"Changed Type", {"Timestamp"}, {{"Value", each List.Sum([Value]), type nullable number}})
in
    Output

 

Kind regards,

John

View solution in original post

2 REPLIES 2
jbwtp
Memorable Member
Memorable Member

Hi @Anonymous,

 

Something like this:

let
    Streams = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("i45WMtU3MNM3MjAyUtJRMgRhA6VYHUxhI4iwObqwMXZh7KpNMc0GS5niEzYnTtgMqyjIIbEA", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [Timestamp = _t, Stream = _t, Value = _t]),
    Totals = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("i45WMtU3MNM3MjAyUtJRMjVQitXBKmSOJGSGKWSOKWQBFIoFAA==", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [Timestamp = _t, Value = _t]),
    ReverseSignonStreams = Table.TransformColumns(Streams, {"Value", each Number.From(_) * -1}),
    Combine = Table.Combine({Totals, ReverseSignonStreams}),
    #"Changed Type" = Table.TransformColumnTypes(Combine,{{"Value", type number}}),
    Output = Table.Group(#"Changed Type", {"Timestamp"}, {{"Value", each List.Sum([Value]), type nullable number}})
in
    Output

 

Kind regards,

John

KT_Bsmart2gethe
Impactful Individual
Impactful Individual

Hi @Anonymous ,

 

I created a blank query for the output. See below outcome and code:

KT_Bsmart2gethe_0-1660082963390.png

 

Regards

KT

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 Kudoed Authors