Forum Discussion

Itchn2go's avatar
Itchn2go
Copper Contributor
Oct 11, 2020

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. 

 

https://www.dropbox.com/s/p16nk9pdjqrpkjs/Screenshot%202020-10-10%20210858.jpg?dl=0 

 

Any help is appreciated. 

11 Replies

  • SergeiBaklan's avatar
    SergeiBaklan
    Diamond Contributor

    Itchn2go 

    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.

     

    • Itchn2go's avatar
      Itchn2go
      Copper Contributor

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

    • Itchn2go's avatar
      Itchn2go
      Copper Contributor

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

      • SergeiBaklan's avatar
        SergeiBaklan
        Diamond Contributor

        Itchn2go 

        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.

Resources