Starting December 3, join live sessions with database experts and the Microsoft product team to learn just how easy it is to get started
Learn moreGet certified in Microsoft Fabric—for free! For a limited time, get a free DP-600 exam voucher to use by the end of 2024. Register now
Hi,
This is an example of what I'm trying to do in Power Query. I have a list of records (20 IDs A-T) and want to assign them to four groups of 5 (GROUP) with a number for each member within the group (GROUP_REF). So I'm trying to create the middle and right hand columns in this example;
Can anyone help me with some code that might achieve this?
Thank you,
Best,
DHB
Solved! Go to Solution.
= let IDs={"A".."T"} in #table({"ID","Group","Group_Ref"},List.Transform(List.Positions(IDs),each {IDs{_},Number.IntegerDivide(_,5)+1,Number.Mod(_,5)+1}))
= let IDs={"A".."T"} in #table({"ID","Group","Group_Ref"},List.Transform(List.Positions(IDs),each {IDs{_},Number.IntegerDivide(_,5)+1,Number.Mod(_,5)+1}))
Thank you @wdx223_Daniel that works perfectly. When I try to apply it to a data set where the "ID" field is called "PERSON_CODE" and the values are random strings of 7 numerical characters (e.g. 1234567, 7654321...) it errors. Do you know of a tweak I could apply to get it working again?
Can show more details about error or attach a snapshoot?
Hi @wdx223_Daniel I only just saw your message. In the meantime I found an alternative solution which worked...
Thank you for your help - it certainly got me looking in the right area.
Starting December 3, join live sessions with database experts and the Fabric product team to learn just how easy it is to get started.
March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount! Early Bird pricing ends December 9th.
User | Count |
---|---|
26 | |
12 | |
11 | |
11 | |
8 |
User | Count |
---|---|
53 | |
28 | |
16 | |
14 | |
13 |