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

Get Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Request now

Reply
2NV_DB
Frequent Visitor

Sum column only if value in another column does not equal x

Hello all,

 

I have the following scenario and I'm stumped on how to tackle it.

 

I have two tables like so:

2024-02-20_12h40_39.png

 

I would like to sum the Sales column in Table2, only if the Percentage in Table 1 is not equal to 123 for the same Customer Number and Category.

 

Is this possible? I've considered merging my queries but I'm not sure how to develop a measure to sum accross columns.

 

Cheers,

1 ACCEPTED SOLUTION
Anonymous
Not applicable

Hi @2NV_DB ,

Please try below steps:

1. merge Table1 and Table2 in Power Query

let
    Source = Table.NestedJoin(Table2, {"Customer Number"}, Table1, {"Customer Number"}, "Table1", JoinKind.Inner),
    #"Expanded Table1" = Table.ExpandTableColumn(Source, "Table1", {"Customer Number", "Category", "Percentage"}, {"Table1.Customer Number", "Table1.Category", "Table1.Percentage"})
in
    #"Expanded Table1"

2. create a measure with below dax formula

Conditional Sales Sum = 
    CALCULATE(
        SUM(Table3[Sales]),
        FILTER(
            Table3,
            Table3[Table1.Percentage] <> 123 
        )
    )

3. add a card visual with measure

vbinbinyumsft_0-1708496075353.png

Please refer the attached .pbix file.

 

Best regards,
Community Support Team_Binbin Yu
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
Anonymous
Not applicable

Hi @2NV_DB ,

Please try below steps:

1. merge Table1 and Table2 in Power Query

let
    Source = Table.NestedJoin(Table2, {"Customer Number"}, Table1, {"Customer Number"}, "Table1", JoinKind.Inner),
    #"Expanded Table1" = Table.ExpandTableColumn(Source, "Table1", {"Customer Number", "Category", "Percentage"}, {"Table1.Customer Number", "Table1.Category", "Table1.Percentage"})
in
    #"Expanded Table1"

2. create a measure with below dax formula

Conditional Sales Sum = 
    CALCULATE(
        SUM(Table3[Sales]),
        FILTER(
            Table3,
            Table3[Table1.Percentage] <> 123 
        )
    )

3. add a card visual with measure

vbinbinyumsft_0-1708496075353.png

Please refer the attached .pbix file.

 

Best regards,
Community Support Team_Binbin Yu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Helpful resources

Announcements
Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

October Power BI Update Carousel

Power BI Monthly Update - October 2025

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

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.