cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
LizAdams
New Member

Error -- 'Apply_to_each' / Power BI

Hi,

Brand new to Power Automate.  I'm trying to use a connection in Power BI to send out an email when the button is pushed on my dashboard. 

The flow is connected a visual with a list of emails and once up and running, should send an email to each person on the list.  

 

I'm getting the following error:


The execution of template action 'Apply_to_each' failed: the result of the evaluation of 'foreach' expression '@triggerBody()?['entity']?['Power BI values']' is of type 'Null'. The result must be a valid array.

 

Within the email body is dynamic information from the PowerBI visual - like name, number, etc.  There are no null values in my data, so I'm not sure where the 'Null' above is coming from. 


Any help would be greatly appreciated!

 

LizAdams_0-1626973674236.png

 

1 ACCEPTED SOLUTION

Accepted Solutions
DamoBird365
Super User
Super User

Hi @LizAdams 

 

The null is referring to the "output from previous step" in the apply to each.  Did you create the apply to each or did Flow?  I would stick a compose into your flow above the apply to each and insert the "Power BI Data" dynamic value.  Then run the flow and look back at the history to see what data you are playing with.  

 

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Cheers,
Damien


P.S. take a look at my new blog here and like & subscribe to my YouTube Channel thanks 😉

View solution in original post

4 REPLIES 4
DamoBird365
Super User
Super User

Hi @LizAdams 

 

The null is referring to the "output from previous step" in the apply to each.  Did you create the apply to each or did Flow?  I would stick a compose into your flow above the apply to each and insert the "Power BI Data" dynamic value.  Then run the flow and look back at the history to see what data you are playing with.  

 

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Cheers,
Damien


P.S. take a look at my new blog here and like & subscribe to my YouTube Channel thanks 😉

View solution in original post

Hi @DamoBird365,

THANK YOU!!

Flow added the apply to each automatically.  Adding the compose above worked!  

If it's not too big of an explanation - could you share what that action is doing?  Is it making the PowerBI data a query-able table?  

Hi @LizAdams 

 

Glad you appear sorted, however the compose shouldn't resolve the issue.  It was more a way to demonstrate the data being retrieved by that dynamic value and I was hoping it would highlight to you why the apply to each was failing.  The apply to each will always expect an array ["valueorobject1","valueorobject2","valueorobject3"] etc.

 

If you choose a dynamic value in an action (send email for instance) and it is part of an array, powerautomate will insert an apply to each as it will assume that there are multiple objects and will therefore need to loop through them all.  If you know the array will only contain one object, you can reference it by using the first() expression.

 

I explain some of these concepts in the following video https://youtu.be/6nJSUNh579w

 

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Cheers,
Damien


P.S. take a look at my new blog here and like & subscribe to my YouTube Channel thanks 😉

 

@DamoBird365 - thank you, I'll check out your video!  I appreciate your help 😀

Helpful resources

Announcements
UG GA Amplification 768x460.png

Launching new user group features

Learn how to create your own user groups today!

Community Connections 768x460.jpg

Community & How To Videos

Check out the new Power Platform Community Connections gallery!

M365 768x460.jpg

Microsoft 365 Collaboration Conference | December 7–9, 2021

Join us, in-person, December 7–9 in Las Vegas, for the largest gathering of the Microsoft community in the world.

Users online (3,602)