Forum Discussion
sdb_utd
6 years agoFrequent Visitor
Total meausre problems
Sample PBIX - https://www.dropbox.com/s/vob4ngqfkxt3ss5/TeaSugar_Sample.pbix?dl=0 I've read several posts on this, but it's still not working for me. I'm looking at an invoice table with products...
ImkeF
Community Champion
6 years agoHi sdb_utd ,
you have to iterate over the VALUES of the Product-column like so:
Weighted Change =
if (HASONEFILTER(('Table'[Product])),
[Change]*[Percent of total],
SUMX(VALUES('Table'[Product]),[Change]*[Percent of total])
)
- sdb_utd6 years agoFrequent Visitor
OMG, you would not believe how frustrating this was. Thanks!
- ImkeF6 years ago
Community Champion
I totally believe you!
Have been there so many times as well...
- sdb_utd6 years agoFrequent Visitor
Last one - I'm trying to get the total working for the start and end cost.
In the table, the values shown are the average start costs for each product. For the total I want the total of the start price, eg. in this case the total start cost should be 305 (sugar on 1st Feb and tea on 2nd Feb)
I don't seem to be able to get the syntax right.
StartCost = VAR datestart = CALCULATE(MIN('Table'[Date]),ALLEXCEPT('Table','Table'[Product],'Table'[Date])) return if (HASONEFILTER('Table'[Product]), CALCULATE(average('Table'[Cost]),FILTER(ALL('Table'),'Table'[Date]=datestart)), sumx(VALUES('Table'[Cost]),'Table'[Cost]))