Hi Cem,
Thank you for reaching out on Microsoft Q&A!
You use join(), but this joins all items in an array as a string with a delimiter. To join two arrays together you need to use union():
union(variables('userA'),variables('userB'))
With the joined arrays you can now use the sort() function to sort them properly:
sort(union(variables('userA'),variables('userB')))
With the result you can use the join() again to make a string of your combined and sorted array:
join(sort(union(variables('userA'),variables('userB')),item()),'; ')
Please click “Accept answer” if you find this helpful. Feel free to drop additional queries in the comments below!
Kind regards,
Sonny