Having trouble with the ANY() function. ANY(...

Having trouble with the ANY() function.

ANY(Table[Column]) does not seem to be returning a random value, but the first value in the list every time. Same thing with ANY(SELECT(Table[Column], TRUE)).

Am I reading the documentation wrong? It seems like either of these expressions should return a random value from the list.

0 5 415
5 REPLIES 5

@Twenty_West_KC

ANY expression always returns the first value in the list. Provided you want to return a random value from the list, you can use this expression:

INDEX(SPLIT(SELECT(TableName[ColumnName],TRUE),","),RANDBETWEEN(1, COUNT(TableName[ColumnName])))

ANY() doesnโ€™t guarantee which item it returns. The current implementation happens to return the first item in the list.

Thanks @Levent_KULACOGLU , I will give this a try

@Levent_KULACOGLU The SPLIT is not needed because the SELECT expression produces the list already.

Thanks @Aleksi_Alkio

I realized that later

Top Labels in this Space