Forum Discussion
Addition/Substraction operators problem in DAX measure
Hello everyone!
I'm creating a simple measure of following type:
Measure1 = ( SUM(Table1[Column1]) / SUM(Table1[Column2]) ) + 2
As the result all matrix visuals (some columns from Table1 selected previosuly) become invisible expect the Measure,1 but the result of the measure is incorrect, it gives me 2 instead of adding this number to the result of SUM(Table1[Column1]) / SUM(Table1[Column2]).
The interesting part comes when I change the addition operator to multiplication/division operator. In this case it works perfectly and calculates the result correctly!
Any ideas why is it happen?
Thank you!
I always recommend to use codes or keys when creating relationships. Avoid using description as a key between the tables because they are tricky, the same description might be available in both tables but one might have an extra space at the end :)
3 Replies
- OmegaImpactful Individual
Please share an example and screenshot of the data :)
- Sergii24Super User
Hi!
Actually the issue has been resolved when I was preparing a test example for you, so thank you! :)
Still not sure what it was, but try to expain: there are 2 interconnected tables (relation many to one) and I had a product description in both. As soon as I used the description from the table that has only one line for each product the measure started to work properly. Instead, when I used the product description from the other table, where it repeated couple of times (same product, but different week or product location) the described in the problem issue repeated again and again.
So, as a conclusion, I think it all happened because Power BI measure couldn't always correctly identify the row context.
- OmegaImpactful Individual
I always recommend to use codes or keys when creating relationships. Avoid using description as a key between the tables because they are tricky, the same description might be available in both tables but one might have an extra space at the end :)