Forum Discussion
Count control by Date Slicer
- 6 years ago
Anonymous , count calculation is wrong
Try
Value by Class = VAR currentClassTable = FILTER(ALLSELECTED('Sales table'[Product]), [Class] in values('Pareto classification'[Product class])) RETURN SWITCH (SELECTEDVALUE('P&L'[P&L]), "Count", SUMX(currentClassTable, CALCULATE(DISTINCTCOUNT('Sales table'[Product])))// COUNTROWS(currentClassTable) , "Units" , SUMX(currentClassTable, CALCULATE(SUM('Sales table'[Units]))) , "Sales" , SUMX(currentClassTable, CALCULATE(SUM('Sales table'[Sales]))) , "Margin", SUMX(currentClassTable, CALCULATE(SUM('Sales table'[Margin]))))
Anonymous , Try these
VAR currentClassTable = FILTER(ALLSELECTED('Sales table'[Product]), [Class] in values('Pareto classification'[Product class]))
or
VAR currentClassTable = FILTER(ALLSELECTED('Sales table'[Product]), [Class] in allselected('Pareto classification'[Product class]))
but if they are related table you do not need to do this
- Anonymous6 years agoNot applicable
amitchandak Thanks so much! However it doesn't work, the results are as below.
VAR currentClassTable = FILTER(ALLSELECTED('Sales table'[Product]), [Class] in values('Pareto classification'[Product class]))
VAR currentClassTable = FILTER(ALLSELECTED('Sales table'[Product]), [Class] in allselected('Pareto classification'[Product class]))
- amitchandak6 years ago
Super User
Anonymous , count calculation is wrong
Try
Value by Class = VAR currentClassTable = FILTER(ALLSELECTED('Sales table'[Product]), [Class] in values('Pareto classification'[Product class])) RETURN SWITCH (SELECTEDVALUE('P&L'[P&L]), "Count", SUMX(currentClassTable, CALCULATE(DISTINCTCOUNT('Sales table'[Product])))// COUNTROWS(currentClassTable) , "Units" , SUMX(currentClassTable, CALCULATE(SUM('Sales table'[Units]))) , "Sales" , SUMX(currentClassTable, CALCULATE(SUM('Sales table'[Sales]))) , "Margin", SUMX(currentClassTable, CALCULATE(SUM('Sales table'[Margin]))))- Anonymous6 years agoNot applicable
amitchandak It's work now, many thanks