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

Join us for an expert-led overview of the tools and concepts you'll need to become a Certified Power BI Data Analyst and pass exam PL-300. Register now.

Reply
bao_nguyen
Frequent Visitor

Traversing rows without loop

Hello,

 

I am trying to achieve this task:

  • Create a new column called 'color':
    • Starting at the max/highest index and traversing backward to the lowest index with these rules 
      1. If current value > A
        1. set color red
        2. move next
      2. Else, If current and two previous values > B,
        1. set color orange for all three rows,
        2. skip the next 2 rows
      3. Else, If current and 4 previous values > C,
        1. set color yellow for all 5 rows,
        2. skip the next 4 rows
      4. Else, set color black, move next

Rule 1 has higher priority than Rule 2, and so on.

I am able to achieve the task but it's involved creating multiple extra columns just for one column. This is not ideal because I will have at least 20 columns.

 

Any input or help is greatly appreciate!

Thanks!

powerbi sample data.png

B

1 REPLY 1
Daniel29195
Super User
Super User

@bao_nguyen 

 

please share simple sample data with the desired output . 

 

best regards

Helpful resources

Announcements
Join our Fabric User Panel

Join our Fabric User Panel

This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.

June 2025 Power BI Update Carousel

Power BI Monthly Update - June 2025

Check out the June 2025 Power BI update to learn about new features.

June 2025 community update carousel

Fabric Community Update - June 2025

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