The ultimate Fabric, Power BI, SQL, and AI community-led learning event. Save €200 with code FABCOMM.
Get registeredCompete to become Power BI Data Viz World Champion! First round ends August 18th. Get started.
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
Solved! Go to Solution.
Units_Department_Customer =
CALCULATE(
SUM(SalesInvoice[Units]),
TREATAS(VALUES(Product[Class]), SalesInvoice[Class]),
ALLEXCEPT(Product, Product[Department]),
ALLEXCEPT(Customer, Customer[Customer])
)
Units_Department_Customer =
CALCULATE(
SUM(SalesInvoice[Units]),
TREATAS(VALUES(Product[Class]), SalesInvoice[Class]),
ALLEXCEPT(Product, Product[Department]),
ALLEXCEPT(Customer, Customer[Customer])
)
@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
User | Count |
---|---|
25 | |
10 | |
8 | |
7 | |
6 |
User | Count |
---|---|
32 | |
12 | |
10 | |
10 | |
9 |