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

Get Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Request now

Reply
jcawley
Helper III
Helper III

Label Column based on other Column Value

Good afternoon Power BI Community,

 

I’m having a problem with a column. Let’s say I have a table with two columns. One that lists Invoice Number, and another that lists Color. I want to create a column that labels them all one value if a certain value is present.

In this case, if "blue" is ever mentioned in assocaition with an Invoice Number, I want a column that repeats "blue" for all lines associated with the invoice number.

EX:

 

Invoice NumberColordesired output
123redblue
123redblue
456redred
123blueblue

 

Any help would be greatly appreciated!

1 ACCEPTED SOLUTION
Ashish_Mathur
Super User
Super User

Hi,

This calculated column formula works

=if(CALCULATE(COUNTROWS(Data),FILTER(Data,Data[Invoice Number]=EARLIER(Data[Invoice Number])&&Data[Color]="Blue"))>0,"Blue"
,Data[Color])

Hope this helps

Untitled.png


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/

View solution in original post

3 REPLIES 3
Ashish_Mathur
Super User
Super User

Hi,

This calculated column formula works

=if(CALCULATE(COUNTROWS(Data),FILTER(Data,Data[Invoice Number]=EARLIER(Data[Invoice Number])&&Data[Color]="Blue"))>0,"Blue"
,Data[Color])

Hope this helps

Untitled.png


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/

Works! Thank you!

You are welcome.


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/

Helpful resources

Announcements
November Power BI Update Carousel

Power BI Monthly Update - November 2025

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

Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.

Top Solution Authors
Top Kudoed Authors