Forum Discussion
qp_andy
6 years agoFrequent Visitor
Using a measure as a filter for another measure
Hi In the example below, I'm trying to create a measure to count the number of SiteRefs where the cumulative value of size is greater than 0: So the correct answer would be 4 for Januar...
- 6 years ago
You should never attempt such a problem without a dimension table on the site.
Try this
Measure = SUMX(VALUES(UniqueSites[Site]),if([Site Size Cumulative] >0,1,0))Note the new dimenstion table called UniqueSites
Greg_Deckler
Community Champion
6 years agoNot sure I am 100% understanding but typically you would do something along the lines of:
VAR __Table = 'Table' //current table rows in context
VAR __Table1 = ADDCOLUMNS(__Table,"Measure",[Some measure])
RETURN
COUNTX(FILTER(__Table1,[Measure] > 0),[Column])
Something along those lines, sometimes you need to do a SUMMARIZE for your initial table.
VAR __Table = 'Table' //current table rows in context
VAR __Table1 = ADDCOLUMNS(__Table,"Measure",[Some measure])
RETURN
COUNTX(FILTER(__Table1,[Measure] > 0),[Column])
Something along those lines, sometimes you need to do a SUMMARIZE for your initial table.
qp_andy
6 years agoFrequent Visitor
Thanks Greg. Sorry probably wasn't 100% clear. The matrix in the original post shows the cumulative values by month for each SiteRef. What I am trying to do is come up with a way to count the number of SiteRefs in each month that have a cumulative size greater than zero.
Not sure what you are referring to by [column] in your reply?
- qp_andy6 years agoFrequent Visitor
Greg_Deckler following your advice I've got part of the way there! I've created a measure which works without context....what I cannot work out is why an error is produced when context is added
Regards
Andy