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
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
bestevez
7 years agoHelper I
Thanks, this solution is perfect.