2 min readfrom Microsoft Excel | Help & Support with your Formula, Macro, and VBA problems | A Reddit Community

Filter and Group by using Power Query or Excel formula?

Our take

When calculating average annualized salary across your company, you have two approaches: using Power Query or Excel formulas. Power Query allows for efficient data manipulation, letting you filter out department B and group by employee number seamlessly. Alternatively, you can utilize Excel formulas to achieve the same results, applying filters and calculations directly within your spreadsheet. Each method has its merits, but Power Query may offer a more streamlined process for handling complex datasets.

Let’s say I want to calculate average annualized salary over my company.

My data set is

Department | Employee Number | Salary Grade | Annualized Salary | FTE %

Someone can work 60% on a level 1 salary for department A and 40% on a level 2 salary for department B. In the dataset this person has 2 rows.

There are two metrics I want to calculate:

  1. average annualized salary across the whole company
  2. average annualized salary across the whole company excluding department B

For 1 - that employee’s annualized salary need to be recalculated as 60% * lvl1 + 40% lvl 2 to get one row per employee

For 2 - I filter out all department B salaries so that employee’s annualized salary is simply their lvl 1 salary

Question: Should I:

Create two tables in power query, filter out department B in one table using Power Query, group by employee number for both tables in power query, output both queries as tables in excel, create 2 pivot tables to calculate averages

OR

  1. Use excel formulas to do everything: filter and group by and calculate 2 averages
submitted by /u/Interesting-System
[link] [comments]

Read on the original site

Open the publisher's page for the full experience

View original article

Related Articles

Tagged with