Antonio Giannattasio
New Member
Members
Forum Posts: 2
Member Since:
February 8, 2024
February 8, 2024
Offline
I would like to ask you help about the possibility calculate subset sum in power query.
My problem is to find the addends that sumup to a specific result. For example I have a list of 20 numbers and a list o 3 numbers (that represent the sum of the numbers in the first list). I have to find witch number composes each sum in in the list of sums (3 sum groups). I hope you managed to understand my problem and I hope it is feasible in PowerQuery.
I tried to generate this code with ChatGPT (it works but is is too resource intensive, (I feel that there are more lighter solutions ):
let // Definizione della lista originale numbers = {1, 2, 3},
// Bufferizzazione della lista originale bufferedNumbers = List.Buffer(numbers),
// Generazione di tutti i sottoinsiemi allSubsets = List.Accumulate(bufferedNumbers, { {} }, (state, current) => state & List.Transform(state, each _ & {current})),
// Output: Tutti i sottoinsiemi output = allSubsets in output
Thank you very much and I look forward to hearing from you
AG
Riny van Eekelen
Örnsköldsvik, Sweden
Moderator
Members
Moderators
Moderators
Forum Posts: 1050
Member Since:
January 31, 2022
January 31, 2022
Offline
Antonio Giannattasio
New Member
Members
Forum Posts: 2
Member Since:
February 8, 2024
February 8, 2024
Offline
Dear Alan,
I send to you an excel file with the expected result.
I have to match for each date in the list on the left the numbers that add up in the lists on the right.
I used colours to give a more easily view to the result. I hope it's clearer now.
Thank you
Kind regards
AG
Forum Timezone: Australia/Brisbane
Most Users Ever Online: 245
Currently Online:
Guest(s) 6
Currently Browsing this Page:
1 Guest(s)
1 Guest(s)
Top Posters:
Catalin Bombea: 1939
SunnyKow: 1432
Anders Sehlstedt: 930
Purfleet: 415
Hans Hallebeek: 354
Frans Visser: 349
David_Ng: 312
lea cohen: 248
Jessica Stewart: 219
A.Maurizio: 216
Newest Members:
QkBXoylJZ ionivxwYdRFNFL
kEUeirrVvEo LuuDySmTmIizW
uavBfwotTrMPA NIQkZzprwMG
qVMPnaSzpgZ uaHBwyav
rCkwbAORdf eaYibAkYjfXT
eNvhcbgYvaPRp nImfgnjOk
kwKbBpnpPjgKuhr LSOUORDzhcRqQ
CPUXMYKMkLuXs iAsOmBtNLn
Clive Webb
EXerOrqW PRqmMlMeyNd
Forum Stats:
Groups: 3
Forums: 25
Topics: 7095
Posts: 31105
Member Stats:
Guest Posters: 49
Members: 34537
Moderators: 2
Admins: 3
Administrators: Mynda Treacy, Philip Treacy, Jessica
Moderators: Velouria, Riny van Eekelen
© Simple:Press —