Hello,
For certain products, we have a variable pricing concept and through a power pivot table we're trying to determine - by product (row) - for every sales price (value) the mean, deviation from mean and standard deviation. We use measures in the pivot table to come to the standard deviation - per product. As we need to be able to filter within the pivot table. We assume that we lose analytical capabilities if we move these fields as calculated columns in the data model.
We are stuck with a double, or nested, COUNTX & SUMX.
Refer to the example below. Assume we have product A with 5 sales entries. We need (1) the mean price for this product, (2) for every of the 5 sales entries the deviation of the sales price from the mean, and (3) for every of the 5 sales entries the standard deviation. To determine the mean, you need the total price column (4,50) divided by the number of sales items (5). To determine the deviation per sales entry, you need both values available on every row.
'Measure 1' is a stepping-stone to get to the mean. We use DAX formula =CALCULATE(COUNTAX(Table3, Table3[Counter]), ALL(Table3[ID])). It sums up the number of items in scope, based on the Counter column, and set the result (5) in every line. This works fine.
Another summarization is needed. The example in 'measure 2' is significantly simplified.
For 'measure 2' we want to summarize the values of 'measure 1' and put the outcome (25) in every line. We used DAX formula =CALCULATE(COUNTAX(Table3, Table3[Measure 1]), ALL(Table3[ID])). This does not work. The outcome is that the 'measure 1' value (5) is put in 'measure 2' in every line. It seems that a measure with COUNTX on a measure with COUNTX is not working. The same problem applies with a measure with SUMX on a measure with a SUMX. Then, the output is always 0.00.
Is it correct that a COUNTX on a COUNTX, and a SUMX on a SUMX is not possible?
Are there alternative ways how to create a pivot table measure that sets the values as per the 'measure 2' of the example?
Thank you,
Luuk
For certain products, we have a variable pricing concept and through a power pivot table we're trying to determine - by product (row) - for every sales price (value) the mean, deviation from mean and standard deviation. We use measures in the pivot table to come to the standard deviation - per product. As we need to be able to filter within the pivot table. We assume that we lose analytical capabilities if we move these fields as calculated columns in the data model.
We are stuck with a double, or nested, COUNTX & SUMX.
Refer to the example below. Assume we have product A with 5 sales entries. We need (1) the mean price for this product, (2) for every of the 5 sales entries the deviation of the sales price from the mean, and (3) for every of the 5 sales entries the standard deviation. To determine the mean, you need the total price column (4,50) divided by the number of sales items (5). To determine the deviation per sales entry, you need both values available on every row.
'Measure 1' is a stepping-stone to get to the mean. We use DAX formula =CALCULATE(COUNTAX(Table3, Table3[Counter]), ALL(Table3[ID])). It sums up the number of items in scope, based on the Counter column, and set the result (5) in every line. This works fine.
Another summarization is needed. The example in 'measure 2' is significantly simplified.
For 'measure 2' we want to summarize the values of 'measure 1' and put the outcome (25) in every line. We used DAX formula =CALCULATE(COUNTAX(Table3, Table3[Measure 1]), ALL(Table3[ID])). This does not work. The outcome is that the 'measure 1' value (5) is put in 'measure 2' in every line. It seems that a measure with COUNTX on a measure with COUNTX is not working. The same problem applies with a measure with SUMX on a measure with a SUMX. Then, the output is always 0.00.
Is it correct that a COUNTX on a COUNTX, and a SUMX on a SUMX is not possible?
Are there alternative ways how to create a pivot table measure that sets the values as per the 'measure 2' of the example?
Thank you,
Luuk