Share via

Power query M pivot table/filter function

Fredrik Söderholm Pettersson 81 Reputation points
2021-02-21T14:01:32.287+00:00

Hi, I have a problem that I can solve.
I have a database with sales data. I want to be able to show this data as sales per product group in an Excel pivot table,
1 column with the total sales of the company for each product group and 1 column with only the sales from one or more specifc vendor/s that I specify with a filter in the Excel pivot table.

I dont know how to keep the total sales of the product group when I use the filter for a specific vendor?

I know I can make a specific column in my power query editor but then I have to specify what vendor it should be already there and I need to be able to choose this with the filter in the Excel Pivot table.

I would like it to look similar to this (i don't know if I managed to upload the image.
70382-image.png

Community Center | Not monitored
0 comments No comments

Answer accepted by question author

Lz365 38,201 Reputation points Volunteer Moderator
2021-02-22T07:22:02.4+00:00

Hi @Fredrik Söderholm Pettersson

A picture of your source table would have helped... Assuming Table1 loaded as is to the Data Model:

70418-table1.png

1/ Create measure Total Sales: =SUM(Table1[Amount])
With your scenario use it for your expected Vendor Sales column

2/ Create measure Total Company Sales: =CALCULATE([Total Sales];ALL(Table1[Vendor]))

70543-pivot.png

Corresponding sample available here

Was this answer helpful?


0 additional answers

Sort by: Most helpful

Your answer

Answers can be marked as 'Accepted' by the question author and 'Recommended' by moderators, which helps users know the answer solved the author's problem.