Incorrect Productx calculation

Occasional Contributor

I have this equation:

=if (contains (RELATEDTABLE('ItemMaster 1'),[ItemGroupPrefix],"Equ"), PRODUCTX(RELATEDTABLE('Invoices 1'), 0.4 * 'Invoices 1'[LineTotal]),0)


this looks at a column on a table called ItemMaster 1 and if Equ is in the column it multiplies the data in Invoices 1 {LineTotal] by 0.4. On random cells the data is crazy.   See attached. 


Any help is appreciated. 

11 Replies


What is contains ? It is not a built-in function as far as I know.


If in another column to add PRODUCTX() only, without IF(), is it the same result or not?


In general it's better to have more information about the model, in DAX exactly the same formula gives different results depends on context.


@Sergei Baklan  Thanks for the help - I am new at this and trying to learn it on the fly. 


I am trying to multiply a column "LineTotal" in the Tab "Invoices 1" by 0.4 if the column in Tab "ItemMaster 1"  column "ItemGroupPrefix" equals "Equ". 


I am unable to get the productx function to work. I am sure it is me. 


Only formula is not enough. How relationships are built, based on date on something else? If date, is here separate calendar table? Are you on one or many side of relationships? 


Just sample model with few records in each table could help better.

@Sergei Baklan  The answer to the question - is the  ProductX function working without any other expressions is no. i get crazy numbers.

@Sergei BaklanYes, i have a calendar table along with item number master, main customer record (business partner) plus invoices and credits. see attached.  


Thank you. But to which table you add calculated column and how this table is related to ItemMaster 1 and Invoices 1 ?

Thanks for the effort but I am giving up. 


Great, thank you for the update

@Sergei Baklan  Just an update. I got it to work.   Changed Productx to Sumx




I see, thank you