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

Join us for an expert-led overview of the tools and concepts you'll need to become a Certified Power BI Data Analyst and pass exam PL-300. Register now.

Reply
DataScope06
Helper I
Helper I

Sum value by multiple dimensions in multiple tables

I have a data model with several tables. I need to sum the number of items ordered by product category for each customer and each year.

 

Tables listed here:

 

sales_items

OrderIDSKUQty_ordered
11232
21243
31252
41261
51272
61232

 

sales_order

OrderIDCustomerIDOrder_Date
111/1/2020
226/1/2020
331/1/2021
418/1/2021
5212/1/2021
612/1/2022

 

product

SKUProductCategory
123Hats
124Gloves
125Shirts
126Pants
127Shoes

 

date

DateYearMonth
1/1/20202020January
6/1/20202020June
1/1/20212021January
8/1/20212021August
12/1/20212021December
2/1/20222022February

 

Here is the expected output for CustomerID # 1. Note: I do not want this specific to customer #1, it needs to return this type of output for all Customer-Year-ProductCategory combinations. Customer #1 results are only shown as a brief example.

CustomerIDYearProductCategoryQtyOrdered
12020Hats2
12021Pants1
12022Hats2
1 ACCEPTED SOLUTION
Anonymous
Not applicable

Hi @DataScope06 ,

I have created a simple sample, please refer to it to see if it helps you.

Create a measure.

Measure =
CALCULATE (
    MAX ( sales_items[Qty_ordered] ),
    FILTER (
        ALL ( 'product' ),
        'product'[SKU] = SELECTEDVALUE ( sales_items[SKU] )
    )
)

vpollymsft_0-1663551440171.png

The year table has no relationship with other tables, so we cannot output the year column.

 

Best Regards

Community Support Team _ Polly

 

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

View solution in original post

6 REPLIES 6
Anonymous
Not applicable

Hi @DataScope06 ,

I have created a simple sample, please refer to it to see if it helps you.

Create a measure.

Measure =
CALCULATE (
    MAX ( sales_items[Qty_ordered] ),
    FILTER (
        ALL ( 'product' ),
        'product'[SKU] = SELECTEDVALUE ( sales_items[SKU] )
    )
)

vpollymsft_0-1663551440171.png

The year table has no relationship with other tables, so we cannot output the year column.

 

Best Regards

Community Support Team _ Polly

 

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

Thanks for the submission, @Anonymous . The year does have a relationship to other tables. The table, sales_order, has an order_date which joins to the date table. How can year then be tied in?

Anonymous
Not applicable

Hi @DataScope06 ,

You need to sum the number of items ordered by product category for each customer and each year. There are so many year, Who corresponds to which year? And there cannot create relationships among the date table and other tables.

 

Could you also provide the desired output with the pictures like the above?

 

Best Regards

Community Support Team _ Polly

 

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

@Anonymous I just edited the question to make it more specific. I also added an example output.

Anonymous
Not applicable

Hi @DataScope06 ,

Could you please provide some sample data in the tables and the desired output with the sample data?

How to Get Your Question Answered Quickly 

 

 

Best Regards

Community Support Team _ Polly

 

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

Hi @Anonymous, I added some data like you suggested.

Helpful resources

Announcements
Join our Fabric User Panel

Join our Fabric User Panel

This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.

June 2025 Power BI Update Carousel

Power BI Monthly Update - June 2025

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

June 2025 community update carousel

Fabric Community Update - June 2025

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