cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
lucas_dantasc Frequent Visitor
Frequent Visitor

Average using M (Power Query)

Hi,

 

I would like to create a column named as "average" to calculate the avarage for each ag_regional for this whole periods in my data base (the script has to select all dates registred to make the average , I have to select all columns with dates at once instead of write one by one and exclude NULL values from the average)

 

How do I make it happen?

 

Average.jpg

2 ACCEPTED SOLUTIONS

Accepted Solutions
artemus Member
Member

Re: Average using M (Power Query)

It would be something like

each List.Average(Record.FieldValues(_ & [ag_regional=null]))

 

View solution in original post

artemus Member
Member

Re: Average using M (Power Query)

Oh sorry if I wasn't clear, you put that line in a add colums - custom column dialog.

In that case, the line would have:

Average = Table.AddColumns(#"Pivoted Column", "Average", <the line I provided starting with each>)

View solution in original post

3 REPLIES 3
artemus Member
Member

Re: Average using M (Power Query)

It would be something like

each List.Average(Record.FieldValues(_ & [ag_regional=null]))

 

View solution in original post

lucas_dantasc Frequent Visitor
Frequent Visitor

Re: Average using M (Power Query)

When I put the Script:

 

scriptmedia.jpg

 

Then It happens, what do I have to put in this blank space?

 

scriptmedia.jpg

artemus Member
Member

Re: Average using M (Power Query)

Oh sorry if I wasn't clear, you put that line in a add colums - custom column dialog.

In that case, the line would have:

Average = Table.AddColumns(#"Pivoted Column", "Average", <the line I provided starting with each>)

View solution in original post

Helpful resources

Announcements
New Kudos Received Badges Coming

New Kudos Received Badges Coming

Kudos to you if you earned one of these! Check your inbox for a notification.

Microsoft Implementation for Communities Wins Award

Microsoft Implementation for Communities Wins Award

Learn about the award-winning innovation that was implemented across Microsoft’s Business Applications Communities.

Power Platform World Tour

Power Platform World Tour

Find out where you can attend!

Top Solution Authors
Top Kudoed Authors (Last 30 Days)
Users online (1,895)