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

Announcements

News and Announcements icon
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 Moderator 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

Introducing the 2026 Season 1 community Super Users

Congratulations to our 2026 Super Users!

Kudos to our 2025 Community Spotlight Honorees

Congratulations to our 2025 community superstars!

Congratulations to the April Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Automate

#1
Vish WR Profile Picture

Vish WR 976

#2
Valantis Profile Picture

Valantis 863

#3
Haque Profile Picture

Haque 547

Last 30 days Overall leaderboard