Forum Discussion
Arendp
Helper III
6 years agosum divided by count
Hello I have a problem with a Dax calc. I need to divide the sum of Metingtest 2 by count Metingtest. That results in Metingtest3. And that result is correct. However in the bottom , you see ...
- Anonymous6 years ago
Hi Arendp ,
I think it needs to be something like this:
AvgRowAndTotal =
// My Dummy MetingTest3Berekening = Divide(sumx ( sales, Sales[Quantity] * Sales[Net Price]),sum(Sales[Quantity]))
Var RowOrTotal =
IF ( ISFILTERED('Product'[Category]), -- replace Product[Category] with your own fields
Divide(sumx ( sales, Sales[Quantity] * Sales[Net Price]),sum(Sales[Quantity])),
SUMX(
Summarize ( -- create temporary table with the same subtotals
Sales, -- you can check them in DAX studio
'Product'[Category],
"rowtotal", Divide(sumx ( sales, Sales[Quantity] * Sales[Net Price]),sum(Sales[Quantity]))
)
, [rowtotal])
)
return RowOrTotalHope this helps,
Jan
Anonymous
6 years agoNot applicable
Hi Arendp ,
I think it needs to be something like this:
AvgRowAndTotal =
// My Dummy MetingTest3Berekening = Divide(sumx ( sales, Sales[Quantity] * Sales[Net Price]),sum(Sales[Quantity]))
Var RowOrTotal =
IF ( ISFILTERED('Product'[Category]), -- replace Product[Category] with your own fields
Divide(sumx ( sales, Sales[Quantity] * Sales[Net Price]),sum(Sales[Quantity])),
SUMX(
Summarize ( -- create temporary table with the same subtotals
Sales, -- you can check them in DAX studio
'Product'[Category],
"rowtotal", Divide(sumx ( sales, Sales[Quantity] * Sales[Net Price]),sum(Sales[Quantity]))
)
, [rowtotal])
)
return RowOrTotal
Hope this helps,
Jan
- Arendp6 years ago
Helper III
That helped, thanks!!