Forum Discussion
Percent of Total
- 10 years ago
Greg_Deckler, I think you meant to use CALCULATE() or switched the order there.
TotalQuantity = SUM( 'Table'[Quantity] ) % Total = [TotalQuantity] / CALCULATE( [TotalQuantity] ,ALL( 'Table' ) ) ***OR*** TotalQuantity = SUM( 'Table'[Quantity] ) % Total = [TotalQuantity] / SUMX( ALL( 'Table' ) ,'Table'[Quantity] )Either construction would work, but I'd lean toward the former idiom.
greggyb No I haven't profiled DIVIDE function but I thought so based on SQLBI article which I trust..
https://www.sqlbi.com/articles/divide-performance/
I think the statement that use of Divide ( or similar ) instead of operator suggests that a measure or data model in not well known or understadable to the author. Sometimes is a matter of style ( like AND() instead of && or the opposite ) or other times the sources are not SQL/DB with data validation but simple excel files that users add manually data prone to errors.
And of course a suggestion on a formula don't implement anything about my (either way limited) knowledge of DAX.
konstantinos, that article is specifically about the performance of DIVIDE() vs the construction:
IF(
[Denominator] <> 0
,[Numerator] / [Denominator]
,<what to do for [Denominator] = 0>
)- konstantinos10 years ago
Memorable Member
greggyb You are right..