Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Score big with last-minute savings on the final tickets to FabCon Vienna. Secure your discount

Reply
Mha35
New Member

Group multiple values from same and different columns

Hello!

 

I have a database that has all the sales from a date, per Product and Currency, by 2 different companies.

 

Data sample:

DateProductCurrencyCompanyValue
01/01/2025AUSDX10
01/01/2025ABRLX10
01/01/2025BUSDX10
01/01/2025CUSDZ10
01/01/2025CBRLX10
02/01/2025AUSDX10
02/01/2025CBRLX10
03/01/2025AUSDZ10
03/01/2025BUSDX10
03/01/2025BBRLX10
04/01/2025AUSDX10
04/01/2025CUSDX10

 

I wanted to put this in powerBI by having the date unique, then grouping by company, then currency and then product. After, I would sum all the values for that date and currency. This is what im trying to achive:

 Company X        Company Z       
  USD   BRL    USD   BRL  
DateABCSUMABCSUM ABCSUMABCSUM
01/01/202510100201001020 0010100000
02/01/2025100010001010 00000000
03/01/20250100100000 1000100000
04/01/202510010200000 00000000

 

8 REPLIES 8
v-dineshya
Community Support
Community Support

Hi @Mha35 ,

Thanks for reaching out to the Microsoft fabric community forum. 

 

Please follow below steps:

Step 1: Load Your Data
In Power BI Desktop, load your sales data into Power BI. Go to Power Query Editor (Transform Data).

Step 2: Add a Missing Column for All Products :
Since your data has zero values for combinations that don't exist, you'll need to ensure all combinations exist (Date, Company, Currency, Product).

In Power Query:

Create reference tables for Date, Company, Currency, and Product. Use Remove Duplicates to create unique value lists.

Create a cross join to generate all combinations (e.g., with a custom step using Table.AddColumn). Merge this master combination table with your actual data to bring in values (with nulls for missing rows). Replace null in the Value column with 0.

Step 3: Add a Matrix visual.

Set up the fields like this:

Rows --->Date
Columns -->Company → Currency → Product
Values -->Sum of Value

Top level: Company

Under Company: Currency

Under Currency: Product


You can turn Subtotals on or off per level (like per Currency or per Company). Rename columns/headers using DAX or calculated columns if needed for cleaner display.


With the matrix set up, Power BI will automatically: Fill missing combinations with 0 (assuming you handled that in Power Query). Aggregate values as needed.

 

If you find this post helpful, please mark it as an "Accept as Solution" and consider giving a KUDOS. Feel free to reach out if you need further assistance.
Thanks and Regards

Hi @Mha35 ,

As we haven’t heard back from you, we wanted to kindly follow up to check if the solution provided for the issue worked? or Let us know if you need any further assistance?
If our response addressed, please mark it as Accept as solution and consider giving a KUDOS. Feel free to reach out if you need further assistance.

 

Regards,

Dinesh

Hi @Mha35 ,

As we haven’t heard back from you, we wanted to kindly follow up to check if the solution provided for the issue worked? or Let us know if you need any further assistance?
If our response addressed, please mark it as Accept as solution and consider giving a KUDOS. Feel free to reach out if you need further assistance.

 

Regards,

Dinesh

Hi @Mha35 ,

As we haven’t heard back from you, we wanted to kindly follow up to check if the solution provided for the issue worked? or Let us know if you need any further assistance?
If our response addressed, please mark it as Accept as solution and consider giving a KUDOS. Feel free to reach out if you need further assistance.

 

Regards,

Dinesh

Hi @Mha35 ,

As we haven’t heard back from you, we wanted to kindly follow up to check if the solution provided for the issue worked? or Let us know if you need any further assistance?

 

Regards,

Dinesh

bhanu_gautam
Super User
Super User

@Mha35 Use Pivot and Group by in Power Query

 

Transform the Data: Use Power Query to pivot and aggregate the data as needed.

Transform the Data
In the Power Query Editor, select your table.
Pivot the data to get the desired structure.
Transformations in Power Query Editor:
Pivot the Data:

Select the Date column.
Click on Transform -> Pivot Column.
In the Pivot Column dialog, select Company as the value column and Value as the aggregation.
Group By:

Select the Date column.
Click on Transform -> Group By.
In the Group By dialog, add a new aggregation for each combination of Company, Currency, and Product.
Create Custom Columns:

Create custom columns to calculate the sum for each combination of Company, Currency, and Product.

 

Create the Matrix Visualization
Go back to the main Power BI interface.
Select the Matrix visualization.
Drag the Date column to the Rows.
Drag the Company column to the Columns.
Drag the Currency column to the Columns.
Drag the Product column to the Columns.
Drag the Value column to the Values.




Did I answer your question? Mark my post as a solution! And Kudos are appreciated

Proud to be a Super User!




LinkedIn






Hi!

 

Many thanks for the step by step guide!

 

Sorry, im kinda new to powerBI. But when i was trying to follow your instructions:

Select the Date column.
Click on Transform -> Pivot Column.
In the Pivot Column dialog, select Company as the value column and Value as the aggregation.

 

I couldnt find the "Value" as the aggregation

Mha35_0-1742389740997.png

 

But even so, the next step consists in selecting the date column again. Should i select all the dates or only one?

Select the Date column.
Go to the "Transform" tab and click on "Pivot Column."
In the Pivot Column dialog, select Company as the value column and Value as the aggregation

 

All dates means basically date column




Did I answer your question? Mark my post as a solution! And Kudos are appreciated

Proud to be a Super User!




LinkedIn






Helpful resources

Announcements
August Power BI Update Carousel

Power BI Monthly Update - August 2025

Check out the August 2025 Power BI update to learn about new features.

August 2025 community update carousel

Fabric Community Update - August 2025

Find out what's new and trending in the Fabric community.