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

Vote for your favorite vizzies from the Power BI Dataviz World Championship submissions. Vote now!

Reply
Kjaer
New Member

If function

I have a table like this

Kjaer_0-1636914191310.png

I want to make a new measure 

Kjaer_1-1636914306549.png

But it doesn´t work. I get this error-message:

A single value for the 'item' column in the 'test' table cannot be determined. This can happen when a measurement formula refers to a column that contains many values ​​without specifying an aggregation function such as min, max, count or sum to form a single result.

 Can anyone help me?

2 ACCEPTED SOLUTIONS
AlexisOlson
Super User
Super User

This code should work if you are writing a calculated column that has the row context to make sense of it.

 

However, for a measure, it doesn't automatically know which row you're referring to when you write "test[item]", so you need to use an aggregation like MAX or SELECTEDVALUE like this:

IF ( SELECTEDVALUE ( test[item] ) = "A", 1, 0 )

View solution in original post

1. I'd probably write that like this:

IF ( SELECTEDVALUE ( test[item] ) IN { "A", "B", "C" }, 1, 0 )

 

2. Font face cannot be conditionally formatted like font color and background color can be. Not yet anyway.

You may want to vote and comment on related ideas like this one:
https://ideas.powerbi.com/ideas/idea/?ideaid=29c97607-0484-4f4a-821a-d1a43ff9fc41

View solution in original post

4 REPLIES 4
Kjaer
New Member

@AlexisOlson 

 

Two more questions:

1. How do I write the aggregation, if I want 1 (one) if test[item] = A or if test[item] = B or if test[item] =C

2. Can the aggregation be written so if the condition is fullfilled (i.e. 1) the font shall change to Serge UI Bold

 

Thanks in advance

1. I'd probably write that like this:

IF ( SELECTEDVALUE ( test[item] ) IN { "A", "B", "C" }, 1, 0 )

 

2. Font face cannot be conditionally formatted like font color and background color can be. Not yet anyway.

You may want to vote and comment on related ideas like this one:
https://ideas.powerbi.com/ideas/idea/?ideaid=29c97607-0484-4f4a-821a-d1a43ff9fc41

Kjaer
New Member

Thanks, it works 😊

But then two more questions:

1. How do I write the aggregation, if I want 1 (one) if test[item] = A or if test[item] = B or if test[item] =C

2. Can the aggregation be written so if the condition is fullfilled (i.e. 1) the font shall change to Serge UI Bold

 

AlexisOlson
Super User
Super User

This code should work if you are writing a calculated column that has the row context to make sense of it.

 

However, for a measure, it doesn't automatically know which row you're referring to when you write "test[item]", so you need to use an aggregation like MAX or SELECTEDVALUE like this:

IF ( SELECTEDVALUE ( test[item] ) = "A", 1, 0 )

Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

Vote for your favorite vizzies from the Power BI World Championship submissions!

Sticker Challenge 2026 Carousel

Join our Community Sticker Challenge 2026

If you love stickers, then you will definitely want to check out our Community Sticker Challenge!

January Power BI Update Carousel

Power BI Monthly Update - January 2026

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

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.