Forum Discussion
DAX Product() function
- 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
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.
- marcorusso7 years agoMost 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_Deckler7 years agoCommunity 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.
- D3nnisd7 years agoFrequent Visitor
Thanks marcorusso , Greg_Deckler and Anonymous for replying!
Changing it to a decimal did the trick.
This raises 2 questions:
- Where is that 0.79 comming from?
- What is the absolute diffrence between a whole number and a decimal. Can the decimal be seen as a float and a whole number as a integer? But this still doesnt explain where the 0.79 come from.
I will report the issue to Microsoft.
- marcorusso7 years agoMost Valuable Professional
Yes, decimal is a float and whole number is an integer.
I don't know why there is this bug - I just imagined that PRODUCT is a function designed to work with decimal numbers because you usually use it to compute compound interests. However, it should work with integers too - Microsoft should answer for that, I would say it's a bug.
Marco Russo - SQLBI
- Anonymous7 years agoNot 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.