Forum Discussion

D3nnisd's avatar
D3nnisd
Frequent Visitor
7 years ago
Solved

DAX Product() function

Hi,

 

I'm a IT student currently self learning DAX as part of my upcomming internship.  I am using this guide to learn and Contoso Sales sample for this part.  So far its fairly straight forward, until now. I haven't been able to figure out the use of Product.

 

The guide tells me to use the Product() function and i'm just taking over what the guide says. But now i get a very different result than the guide tells me i should have.

 

The guide tells me that the result of using Simple Product = PRODUCT(Channel[Channel]) should be 24, but i get 0.791440856024882.  See the following screenshot for refference:


As far as the guide tells me, product should have done 1 x 2 x 3 x 4 = 24 . The information on the MSDN docs doesnt tell me much either.

 

Anyone able to give me a answer?

 

Thanks allot!

 

Cheers, Dennis

 

  • marcorusso's avatar
    marcorusso
    7 years ago

    The Channel column is defined as Whole Number, it should be a Decimal - do that and it returns 24.

    That said - it's funny how it behave with an integer! I suggest submitting the issue to Microsoft.

     

    Marco Russo - SQLBI

8 Replies

  • Greg_Deckler's avatar
    Greg_Deckler
    Community Champion

    Wow, I've been experimenting with this and I can't make heads or tails of what the PRODUCT function is doing. I get some bizarre results such as infinity, etc. that make absolutely no sense what-so-ever. marcorusso do you have any idea what the PRODUCT function is doing here because it certainly does not seem like it is returning the PRODUCT of a column. I cannot make heads or tails of what it is actually doing.

    • marcorusso's avatar
      marcorusso
      Most Valuable Professional

      The Channel column is defined as Whole Number, it should be a Decimal - do that and it returns 24.

      That said - it's funny how it behave with an integer! I suggest submitting the issue to Microsoft.

       

      Marco Russo - SQLBI

      • Greg_Deckler's avatar
        Greg_Deckler
        Community Champion

        Thanks marcorusso, that does solve the issue by making it a decimal number. But, as you said, weird!! I have be believe that is a bug.

    • Anonymous's avatar
      Anonymous
      Not applicable

      I can get productx to give the expected result

       

      For example on a table consisting of integers 1-9

       

      Measure = 

      PRODUCTX ( VALUES ( Table1[Column1] ), Table1[Column1] )

       

      returns 362,880 as expected.

       

      However, 

      Measure = 

      PRODUCTX ( Table1, Table1[Column1] )

       

      returns 0

       

      Which is identical to just PRODUCT() doesnt return the expected result.

       

      So a workaround for this is to use PRODUCTX over VALUES however as for why PRODUCT itself isnt behaving as expected I have no idea. My instinct is that this is a bug but I cant be sure.