Forum Discussion
scotjn1
4 years agoHelper I
cumulative count within DAX table variable
I have been asked for a measure to give the average number of observations of X that have occurred between observations of Y within various samples. To do this, I'm using a DAX table variable within...
amitchandak
4 years agoSuper User
scotjn1 , Try a new column as
var _max = minx(filter(table, [sampleID] = earlier([sampleID]) && [Date] >= earlier([Date]) && [Type1] =1), [Date])
return
sumx(filter(table, [sampleID] = earlier([sampleID]) && [Date] <= _max), [Type2])
If this does not help
Can you share sample data and sample output in table format? Or a sample pbix after removing sensitive data.
scotjn1
4 years agoHelper I
Hello amitchandak,
Thank you for the reply. EARLIER doesn't like that since it "refers to an earlier row context which doesn't exist." Maybe because it's looking at a temp table?
Here's the .pbix with data and the DAX table in question.
Thank you,
Jacob