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

Enhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.

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
July 2025 community update carousel

Fabric Community Update - July 2025

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

July PBI25 Carousel

Power BI Monthly Update - July 2025

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