Forum Discussion
Mbechet
9 years agoFrequent Visitor
Total and filter count distinct values
Hi all, I have a matrix on which I am showing the total count of each value occurences for each row and colu + the count of distinct values. My goal is to get in the matrix only the values for whic...
- Anonymous9 years ago
HI Mbechet,
I modified your formula and it seems work on my side.
Custom = var currentAgent=LASTNONBLANK(Sheet1[Agent],[Agent]) return if(COUNT(Sheet1[Amount])=COUNTX(FILTER(ALL(Sheet1),[Agent]=currentAgent),[Amount])||COUNT(Sheet1[Amount])=COUNTX(ALL(Sheet1),[Amount]),DISTINCTCOUNT(Sheet1[Amount]),COUNT(Sheet1[Amount]))
Notice: if statement check agent group to filter on total row, so if your agent has only one amount category, distinct count formula will also calculate on that row.
Regards,
Xiaoxin Sheng
Anonymous
9 years agoNot applicable
HI Mbechet,
For your scenario, I think you can modify your formula to add a conditional to filter the calculation on total row.
Sample: add condition to check column group.
Custom =
var currentItem=LASTNONBLANK('Sample Table'[Date].[Year],[Date].[Year])
return
IF(COUNTROWS('Sample Table')=COUNTROWS(FILTER(ALL('Sample Table'),[Date].[Year]=currentItem)),"Total Row Formula",SUM([Amount]))
Regards,
Xiaoxin Sheng