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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
cgoldstein
Frequent Visitor

SumIF Relationship Between Tables

Hello!

 

I am needing help as I've tried many methods but am unable to get the modeling to take in PowerBI. Ultimately I am looking to create a subset of a table.

 

I have tried Summarize, however keep getting "refers to multiple columns scalar expression errors"

 

I have (1) table that has EVERYTHING included in it. I am looking to create a 2nd table that includes the following:

 

I would like to group my large table by the following 5 items below, then create 2018 units and 2019 units.

 

-Customer_cd (1)

-Customer_nm (2)

-Location_Channel_cd (3)

-Location_Channel_Detail (4)

-Location_Channel_nm (5)

- New Metric 2018 Units = SUM([Units) where Fiscal_Year_nr = 2018

- New Metric 2019 Units = SUM(Units)) Where Fiscal_Year_nr=2019

 

Existing Table

SalecCurrent.PNG

1 ACCEPTED SOLUTION
v-lili6-msft
Community Support
Community Support

hi, @cgoldstein 

Just try this formula to create a new table

New table =
SUMMARIZE (
    'Table',
    'Table'[Customer_cd],
    'Table'[Customer_nm],
    'Table'[Location_Channel_cd],
    'Table'[Location_Channel_Detail],
    'Table'[Location_Channel_nm],
    "New Metric 2018 Units", CALCULATE ( SUM ( 'Table'[Units] ), 'Table'[Fiscal_Year_nr] = 2018 ),
    "New Metric 2019 Units", CALCULATE ( SUM ( 'Table'[Units] ), 'Table'[Fiscal_Year_nr] = 2019 )
)

If not your case, please share some simple sample data and your expected output.

 

Best Regards,

Lin

Community Support Team _ Lin
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

1 REPLY 1
v-lili6-msft
Community Support
Community Support

hi, @cgoldstein 

Just try this formula to create a new table

New table =
SUMMARIZE (
    'Table',
    'Table'[Customer_cd],
    'Table'[Customer_nm],
    'Table'[Location_Channel_cd],
    'Table'[Location_Channel_Detail],
    'Table'[Location_Channel_nm],
    "New Metric 2018 Units", CALCULATE ( SUM ( 'Table'[Units] ), 'Table'[Fiscal_Year_nr] = 2018 ),
    "New Metric 2019 Units", CALCULATE ( SUM ( 'Table'[Units] ), 'Table'[Fiscal_Year_nr] = 2019 )
)

If not your case, please share some simple sample data and your expected output.

 

Best Regards,

Lin

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

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

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