Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
3 years ago

Table Total not calculating correctly

Hi

 

Hope someone can help me with this.

 

I've created the following measure to calculate Cost as 2 products have bulk cost rules.

 

This works perfectly for me in my table visual. But because I've used the MAX function for the text, the total of this column is way off. What's a way to get around this?

Or is there a better way to have written this statement?

Thanks

 

[Total Sales] is a measure.

 

Total Cost =

IF([Total Sales] <= 3729 && MAX('Product Table'[Product Type])="A", [Total Sales]*232.20 ,

IF(MAX('Product Table'[Product Type])="A", 3729*232.20 + ([Total Sales]-3729)*241.92,

IF([Total Sales]<= 185 && MAX('Product Table'[Product Type])="B", [Total Sales]*333.24,

IF(MAX('Product Table'[Product Type])="B", 185*333.24 + ([Total Sales]-185)*399.24,

[Total Sales]*MAX('Product'[Cost])

))))

2 Replies