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
matthewho
Regular Visitor

Help creating a dax measure

Hi all, I am currently pretty new to Dax/PowerBi and am having trouble writing a Dax.

 

I want my dax to correctly calculate and filter units by both department and customer.

 

I have three tables
SalesInvoice, Product, and Customer.

Within Product there is Department and Class.

Within SalesInvoice there is Class and Customer

Within Customer there is Customer

 

This is my current dax that is not working..

 

Units_Department_Customer = CALCULATE(
SUM(SalesInvoice[Units]),
FILTER(
SalesInvoice,
RELATED(Product[class]) = F_SalesInvoice[class],

--part that I don't know how to do
),
ALLEXCEPT(Product, Product[Department]))

 

 

Thanks

 

 

1 ACCEPTED SOLUTION
aduguid
Super User
Super User

Units_Department_Customer = 
CALCULATE(
    SUM(SalesInvoice[Units]),
    TREATAS(VALUES(Product[Class]), SalesInvoice[Class]),
    ALLEXCEPT(Product, Product[Department]),
    ALLEXCEPT(Customer, Customer[Customer])
)

View solution in original post

2 REPLIES 2
aduguid
Super User
Super User

Units_Department_Customer = 
CALCULATE(
    SUM(SalesInvoice[Units]),
    TREATAS(VALUES(Product[Class]), SalesInvoice[Class]),
    ALLEXCEPT(Product, Product[Department]),
    ALLEXCEPT(Customer, Customer[Customer])
)
sanalytics
Super User
Super User

@matthewho 
Please provide some dummy data along with your model. Also, provide your expected output so that we can try from our end.

Regards

sanalytics

 

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.

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.