Incorrect Productx calculation

Highlighted
Occasional Contributor

Incorrect Productx calculation

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
Highlighted

Re: Incorrect Productx calculation

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

Highlighted

Re: Incorrect Productx calculation

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.

Highlighted

Re: Incorrect Productx calculation

@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.

Highlighted

Re: Incorrect Productx calculation

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.

Highlighted

Re: Incorrect Productx calculation

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

Highlighted

Re: Incorrect Productx calculation

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

Highlighted

Re: Incorrect Productx calculation

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

Highlighted

Re: Incorrect Productx calculation

Thanks for the effort but I am giving up.

Highlighted

Re: Incorrect Productx calculation

Great, thank you for the update

Highlighted

Re: Incorrect Productx calculation

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

Thanks.

Highlighted

I see, thank you