Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.
Hi all,
Let's say you have a Sale query and a StockCard query. They are linked by StockID. In the Stock table is a StockOnHand column.
How do you create a table visualisation that sums Sale values (saleValue, GST etc) and also shows values from the Stock query that are NOT aggregated.
eg.
2 sales for $10 each for the same Stock record. Stock has StockOnHand of 100.
My issue is that the table shows...
Product Total StockOnHand
Coke $20 200
Basically it is adding the stockOnHand twice because there are 2 sales.
This is killing me.
Free beer in Sydney for the winner.
Nick
Hi Nick,
Please try the below DAX query.
stockOnHand_Distinct =
SUMX (
DISTINCT ( TableName[ProductName] ),
CALCULATE ( DISTINCT ( TableName[stockOnHand] ) )
)
Thanks,
Himanshu
Hi,
Thanks for helping me. Should that DAX be a measure on the Sales table or the Stock table? It's giving me an error.
Nick
Error Message:
MdxScript(Model) (11, 91) Calculation error in measure 'Sales'[stockOnHand_Distinct]: A table of multiple values was supplied where a single value was expected.
Seems to work at the lowest level of my heirachy. But when I Drill-Up, it throws that error.
I should add that the table has a 3 level heirachy. Product, Sub Department and Department.
Not sure how to handle heirarchy in this particular situation.
May be you need to use Filter function.
Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City
Check out the April 2024 Power BI update to learn about new features.
User | Count |
---|---|
111 | |
95 | |
80 | |
68 | |
59 |
User | Count |
---|---|
150 | |
119 | |
104 | |
87 | |
67 |