Forum Discussion
bestevez
7 years agoHelper I
DAX problem sum average
Hi, i have a issue about my dax measure. SUM( fac_compras[cantidad] ) * CALCULATE( [avgCosteUnidad]; SAMEPERIODLASTYEAR(dim_date[Date] ) ) all is right, but the total multipli...
- 7 years ago
try this
Measure = VAR __Summary = ADDCOLUMNS ( SUMMARIZE ( 'Table', 'Calendar'[YearMonth] ), "Quantity CY", CALCULATE ( SUM ( 'Table'[Quantity] ) ), "Avg Cost LY", [Average Cost LY] ) RETURN SUMX ( __Summary, [Quantity CY] * [Avg Cost LY] )the total is alignes with your logic here
Stachu
7 years agoCommunity Champion
you need to use SUMX here, e.g. with SUMMARIZECOLUMNS (with whatever is in the rows before the numbers you show)
right now PowerBI adds all rows and then multiplies
you want it to multiply and then add rows, SUMX can do that
bestevez
7 years agoHelper I
Thanks, but I can't think of a way to do the truth.