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

Next up in the FabCon + SQLCon recap series: The roadmap for Microsoft SQL and Maximizing Developer experiences in Fabric. All sessions are available on-demand after the live show. Register now

Reply
GoatTracker
Frequent Visitor

Alternate number based on group

I'm looking to format the POWER QUERY table by group instead of by row.  My Code references are sorted in the query, how can I apply a new column like the example below?

 

CodeGroup
ABC1231
ABC1260
FFR5561
KKI9980
WWA3241
2 ACCEPTED SOLUTIONS
olgad
Resident Rockstar
Resident Rockstar

Hi, how many codes you have, is there any logic in assigning group 1 or group 0? Conditional column will help you to create this column, 

olgad_0-1678337329142.png

if it is 1 for the first row then 2 for the second 1 for the 3rd, 2 for the 4th then
add index column first then custom column
if (Number.IsEven([Index])=true) then 0 else 1

olgad_1-1678337680967.png

Appreaciate your kudos and acceptance of the solution if it works for you.


DID I ANSWER YOUR QUESTION? PLEASE MARK MY POST AS A SOLUTION! APPRECIATE YOUR KUDO/LIKE!
PROUD TO BE A SUPER USER!
Best Stories, Interesting Cases: PowerBI Storytime Newsletter
Linkedin Profile: Linkedin
YouTube Channel: PowerBI Storytime

View solution in original post

if index column and custom column 
if (Number.IsEven([Index])=true) then 0 else 1
is not an option, then please identify the logic based on which you want to assign group 1 group 0?


DID I ANSWER YOUR QUESTION? PLEASE MARK MY POST AS A SOLUTION! APPRECIATE YOUR KUDO/LIKE!
PROUD TO BE A SUPER USER!
Best Stories, Interesting Cases: PowerBI Storytime Newsletter
Linkedin Profile: Linkedin
YouTube Channel: PowerBI Storytime

View solution in original post

3 REPLIES 3
GoatTracker
Frequent Visitor

Hi @olgad I have hundreds not in sequential order unfortunately.

if index column and custom column 
if (Number.IsEven([Index])=true) then 0 else 1
is not an option, then please identify the logic based on which you want to assign group 1 group 0?


DID I ANSWER YOUR QUESTION? PLEASE MARK MY POST AS A SOLUTION! APPRECIATE YOUR KUDO/LIKE!
PROUD TO BE A SUPER USER!
Best Stories, Interesting Cases: PowerBI Storytime Newsletter
Linkedin Profile: Linkedin
YouTube Channel: PowerBI Storytime
olgad
Resident Rockstar
Resident Rockstar

Hi, how many codes you have, is there any logic in assigning group 1 or group 0? Conditional column will help you to create this column, 

olgad_0-1678337329142.png

if it is 1 for the first row then 2 for the second 1 for the 3rd, 2 for the 4th then
add index column first then custom column
if (Number.IsEven([Index])=true) then 0 else 1

olgad_1-1678337680967.png

Appreaciate your kudos and acceptance of the solution if it works for you.


DID I ANSWER YOUR QUESTION? PLEASE MARK MY POST AS A SOLUTION! APPRECIATE YOUR KUDO/LIKE!
PROUD TO BE A SUPER USER!
Best Stories, Interesting Cases: PowerBI Storytime Newsletter
Linkedin Profile: Linkedin
YouTube Channel: PowerBI Storytime

Helpful resources

Announcements
New to Fabric survey Carousel

New to Fabric Survey

If you have recently started exploring Fabric, we'd love to hear how it's going. Your feedback can help with product improvements.

Power BI DataViz World Championships carousel

Power BI DataViz World Championships - June 2026

A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.

Join our Fabric User Panel

Join our Fabric User Panel

Share feedback directly with Fabric product managers, participate in targeted research studies and influence the Fabric roadmap.

March Power BI Update Carousel

Power BI Community Update - March 2026

Check out the March 2026 Power BI update to learn about new features.