web
You’re offline. This is a read only version of the page.
close
Skip to main content

Notifications

Announcements

Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Automate / Apply to each - only p...
Power Automate
Answered

Apply to each - only picking up 1st value

(0) ShareShare
ReportReport
Posted on by 34
Hi folks
 
Building a flow to take data from a csv file and create a new groups in Entra.
During building and testing, the entire flow worked great when I was just pulling a single row from the csv file.
 
Now I'm trying to put it into an 'Apply to each' to create a group per row of data and I'm getting stuck.
 
Here's the full flow:
 
 
Here's the data in the array (the job titles, departments etc)
 
 
Here's inside the 'Apply to each'
 
 
Here's inside the 'Select Data' - we can see it's picking up the multiple job titles
 
 
Here's inside the 'Compose Job Title' - this is where it's only showing the very first job title from the CSV
 
 
This is how the 'Compose Job Title' is composed
 
 
And finally, the error when the flow is run:
 
 
As you can see, when it is trying to move on to the 2nd job title to create a group, it's still picking up the 1st one which already exists.
Where am I going wrong with this?
 
Thanks in advance for any help. Apologies for the amount of screenshots above but I figure more info > less info.
Categories:
I have the same question (0)
  • Verified answer
    NsL Coder Profile Picture
    475 Super User 2025 Season 2 on at
    I don't really understand why you have a filter array, since it does not look like you are filtering anything. Also your error is b/c your compose job title expression is not referencing the item within the loop, but the first item (row) only.
     
    assuming your data doesn't have any "header row" and that comma "," is the separator and never used literally in within any column, this is the simplifed actions needed.
     
    Select Data action From field: split(outputs('CSVData'), outputs('NewLine'))
    Select Data action Map fields:
    split(item(), ',')[0]
    split(item(), ',')[1]
    split(item(), ',')[2]
     
    Apply to each action's Select an output from previous steps field: body('Select_Data')
    Each of the Compose to get the column data: items('Apply_to_each')?['Column 1']
     
    Here's what the run looks like:
     
     
  • LydonNZ Profile Picture
    34 on at
    Awesome, thank you so much!
    That's done the trick, lots of nice new groups created.
     
    Much appreciated

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Forum hierarchy changes are complete!

In our never-ending quest to improve we are simplifying the forum hierarchy…

Ajay Kumar Gannamaneni – Community Spotlight

We are honored to recognize Ajay Kumar Gannamaneni as our Community Spotlight for December…

Leaderboard > Power Automate

#1
Michael E. Gernaey Profile Picture

Michael E. Gernaey 501 Super User 2025 Season 2

#2
Tomac Profile Picture

Tomac 323 Moderator

#3
abm abm Profile Picture

abm abm 237 Most Valuable Professional

Last 30 days Overall leaderboard