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
ElliotP
Post Prodigy
Post Prodigy

If columnA and Column B equal then this

 

3b5aae65ec75419ee6a8cbd9ba9dd4eb.png

 Afternoon guys,

 

I was hoping to create a visual which will display for example "Food + Drink". So when someone orders fritters and a flat white, it shows up in my Food and Drink Column and from that I can create a column which says "Food + Drink".

 

I've thought of going into this a few ways (Concantrate but its limited to two text strings), An IF function, but I can't see to get it to "If Food = Kitchen and Drinks = Drinks" write Food + Drink.

 

A custom column might be the best option but I'm not sure about the code (Useful link: http://community.powerbi.com/t5/Desktop/If-text-column-CONTAINS-specified-value-give-me-what-I-want/...)

 

Thoughts?

 

I'd like to be to do it so each of them had a catagory. So if someone just ordered food, it would just say food. I'm going to make it more granular later (like Coffee + Breakfast), but it's the same principles.

 

Edit: Maybe merging queries somehow? http://community.powerbi.com/t5/Desktop/HOW-Calculated-Column-if-quot-this-column-quot-matches-quot-...

 

Edit2: Custom Colum with:

if ([Food] = Kitchen or [Drink] = Drink) then "Food + Drink"

 ^Doesn't like the code and I'm not sure why; might be missing a if else component?

 

1 ACCEPTED SOLUTION
Anonymous
Not applicable

To cater for the various combinations, how about something like:

Food + Drink = IF ( ISBLANK ( Table1[Food] ) ,
					IF ( ISBLANK ( Table1[Drink] ),
							BLANK (),
							"Drink" ), 
					IF ( ISBLANK ( Table1[Drink] ) ,
							"Food",
							"Food + Drink" )
		)

View solution in original post

22 REPLIES 22

But I'm not able to use COUNT upon the measure [Food+Drink] as well it's a measure. Anyone have an idea how to count the number of text values as a resultant from a measure?

I feel like this will work as a Custom Column, can anybody correct the code? It's asking for a parenthesis after the first left parenthesis.

 

 if ( ISBLANK ( [Section2a] = "Food" ),
			if ( ISBLANK ( [Section2a] = "Drink ),
					BLANK (),
					"Drink" ), 
			if ( ISBLANK ( [Section2a] = "Drink ) ,
					"Food",
					"Food + Drink" )
                )

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