Forum Discussion

DavidQuerol's avatar
DavidQuerol
Frequent Visitor
5 years ago
Solved

A single value for column cannot be determined

Hi, i found similar posts but i cannot relate them to my problem.

I need to do a simple LEFT() function to catch the first 4 characters of a string column but i'm unable to do it.

I create a mesure like this:

Measure = LEFT ( DimProduct[Family] , 4)

[Family] is a colum where there is a string of 8 to 10 characters.


And i get the error 'A single value for column cannot be determined ...'

 

 

 

 

 
  • Hi DavidQuerol

    If you use it in a measure you will need to perform some kind of aggregation on the Family column first. 

    This is due to the fact that the system has no way of knowing if there is going to more than 1 value in the Family column once the measure is calculated. 

    Try this instead:

    Measure = LEFT ( SELECTEDVALUE(DimProduct[Family]) , 4)

    SELECTEDVALUE(DimProduct[Family]) will check to see how many values there are in the family column at the moment of the calculation and if there is only 1 it will return that value, otherwise it will return blank()

    / J


1 Reply

  • tex628's avatar
    tex628
    Community Champion

    Hi DavidQuerol

    If you use it in a measure you will need to perform some kind of aggregation on the Family column first. 

    This is due to the fact that the system has no way of knowing if there is going to more than 1 value in the Family column once the measure is calculated. 

    Try this instead:

    Measure = LEFT ( SELECTEDVALUE(DimProduct[Family]) , 4)

    SELECTEDVALUE(DimProduct[Family]) will check to see how many values there are in the family column at the moment of the calculation and if there is only 1 it will return that value, otherwise it will return blank()

    / J