Forum Discussion
Need DAX help on Calculate, Count and Filter Functionality
- 3 years ago
Anonymous
Not sure if I correctly understand your requirement. Hope this is what you need. See Attached sample file.Count = SUMX ( VALUES ( 'DataSet'[PREM_NB] ), IF ( COUNTROWS ( CALCULATETABLE ( VALUES ( 'DataSet'[CRDT_COLL_ACTN_CD] ), ALL ( 'DataSet'[CRDT_COLL_ACTN_CD] ) ) ) <= 1, CALCULATE ( COUNTA('DataSet'[CRDT_COLL_ACTN_CD]) ) ) ) - 3 years ago
Anonymous
Please try
Count =
SUMX (
SUMMARIZE ( 'DataSet', 'DataSet'[PREM_NB], 'Date'[Week] ),
IF (
COUNTROWS (
CALCULATETABLE (
VALUES ( 'DataSet'[CRDT_COLL_ACTN_CD] ),
ALL ( 'DataSet'[CRDT_COLL_ACTN_CD] )
)
) <= 1,
CALCULATE ( COUNTA ( 'DataSet'[CRDT_COLL_ACTN_CD] ) )
)
)
Hi Anonymous
Please use
Count =
CALCULATE(
COUNTA ( 'DataSet'[CRDT_COLL_ACTN_CD] ),
KEEPFILTERS ( 'DataSet'[CRDT_COLL_ACTN_CD] = "UC" )
)- Anonymous3 years agoNot applicable
Thanks for the reply. Tried that one as well, but I need the filter to remove anything that has a count in the UC and SC & UC and DN as well. So this gets me halfway there, but not fully. I'm not sure how to write the code as a combination, even if there are duplicate PREM_NB.
- tamerj13 years ago
Community Champion
Anonymous
Not sure if I correctly understand your requirement. Hope this is what you need. See Attached sample file.Count = SUMX ( VALUES ( 'DataSet'[PREM_NB] ), IF ( COUNTROWS ( CALCULATETABLE ( VALUES ( 'DataSet'[CRDT_COLL_ACTN_CD] ), ALL ( 'DataSet'[CRDT_COLL_ACTN_CD] ) ) ) <= 1, CALCULATE ( COUNTA('DataSet'[CRDT_COLL_ACTN_CD]) ) ) )- Anonymous3 years agoNot applicable
This seems to have worked for me. Thank you so much!