Enumlist one option auto select

Hello all,

I have an enumlist column that uses a valid if to determine its options.

SPLIT(SELECT(Load Tracking Data[Job ID], ([Site Timesheet] = [_THISROW].[Site_Mo])), ", ")

The number of enumlist options varies.

If there is only one option I would like to have it selected (initial value?)

And also hidden, this I can manage.

I tried to do this in the initial value:

IF(Count(SELECT(Load Tracking Data[Job ID], ([Site Timesheet] = [_THISROW].[Site_Mo]))<=1,FIND(“,”,SELECT(Load Tracking Data[Job ID], ([Site Timesheet] = [_THISROW].[Site_Mo]))),TEXT(“”))

Attempting to count the number of entries, and if it is <=1 then auto select it but it doesnt work.

Does anyone have a better idea?

You need to do the split first before you count. Then you only need to check for a count of 1 because anything else should result in no initial value. If the count is one then the value will be the first result of the select statement.

IF(
  COUNT(
    SPLIT(
      SELECT(
        Load Tracking Data[Job ID], ([Site Timesheet] = [_THISROW].[Site_Mo])
      ), ","
    )
  ) = 1,
  ANY(
    SELECT(
      Load Tracking Data[Job ID], ([Site Timesheet] = [_THISROW].[Site_Mo])
    )
  ), 
  ""
)
1 Like

That worked perfectly! Thank you Graham you legend!

1 Like