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
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
Super User
Super User

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
Super User
Super User

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
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.

AugPowerBI_Carousel

Power BI Monthly Update - August 2024

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

August Carousel

Fabric Community Update - August 2024

Find out what's new and trending in the Fabric Community.

Top Solution Authors
Top Kudoed Authors