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

The Power BI Data Visualization World Championships is back! It's time to submit your entry. Live now!

Reply
StefanoT1982
Regular Visitor

Sumif of multiple corresponding values

Imagine I have this simple physical table:

CHANNELCUSTOMERSALES
RETAILA5
RETAILB2
DISTRIBUTORSB2
DISTRIBUTORSC1

 

(note that CUSTOMER B has 2 different corresponding CHANNELS)

 

How can I create a Dax measure to get this in the pivot without having the CHANNEL column in scope in the selection?

ROWSSALES 
A7ALL RETAIL ROWS (5+2)
B10ALL RETAIL AND DISTRIBUTORS ROWS (5+2+2+1)
C3ALL DISTRIBUTORS ROWS (2+1)
1 ACCEPTED SOLUTION
jgeddes
Super User
Super User

Maybe this measure will work for you.

Measure = 
var _chTable = 
SELECTCOLUMNS('Table',"__channel", [CHANNEL])
RETURN
SUMX(
    FILTER(ALL('Table'), 'Table'[CHANNEL] IN _chTable),
    [SALES]
)




Did I answer your question? Mark my post as a solution!

Proud to be a Super User!





View solution in original post

4 REPLIES 4
Kedar_Pande
Super User
Super User

@StefanoT1982 

 

Sum by Customer Channels :=
VAR ThisCustomer =
SELECTEDVALUE ( Sales[CUSTOMER] )
VAR ChannelsForCustomer =
CALCULATETABLE (
VALUES ( Sales[CHANNEL] ),
Sales[CUSTOMER] = ThisCustomer
)
RETURN
CALCULATE (
SUM ( Sales[SALES] ),
KEEPFILTERS ( Sales[CHANNEL] IN ChannelsForCustomer )
)

 

FBergamaschi
Solution Sage
Solution Sage

Before answering you I need to understand this thing you want to create

 

ROWSSALES 
A7ALL RETAIL ROWS (5+2)
B10ALL RETAIL AND DISTRIBUTORS ROWS (5+2+2+1)
C3ALL DISTRIBUTORS ROWS (2+1)

 

The section ROWS should identify the Customer? Or you simply want the three nrs (7, 10 and 3) and ABC are just a way to identify the three calculations?

 

If this helped, please consider giving kudos and mark as a solution

@me in replies or I'll lose your thread

Want to check your DAX skills? Answer my biweekly DAX challenges on the kubisco Linkedin page

Consider voting this Power BI idea

Francesco Bergamaschi

MBA, M.Eng, M.Econ, Professor of BI

Selva-Salimi
Solution Sage
Solution Sage

Hi @StefanoT1982 ,

 

you can write a measure as follows:

 

measure channel_sales := var chnl = values (your_table [channel])

return

calculate(sum( your_table [sales]) , filter (all(your_table) , your_table [channel] in chnl))

 

then you can use the customer colun from your table and this measure in the visual.

 

If this post helps, then I would appreciate a thumbs up 👍 and mark it as the solution ✔️ to help the other members find it more quickly.

jgeddes
Super User
Super User

Maybe this measure will work for you.

Measure = 
var _chTable = 
SELECTCOLUMNS('Table',"__channel", [CHANNEL])
RETURN
SUMX(
    FILTER(ALL('Table'), 'Table'[CHANNEL] IN _chTable),
    [SALES]
)




Did I answer your question? Mark my post as a solution!

Proud to be a Super User!





Helpful resources

Announcements
December 2025 Power BI Update Carousel

Power BI Monthly Update - December 2025

Check out the December 2025 Power BI Holiday Recap!

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.