Forum Discussion

Kjaer's avatar
Kjaer
New Member
4 years ago
Solved

If function

I have a table like this

I want to make a new measure 

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?

  • 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 )

4 Replies

  • 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 )
  • 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 

     

    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