Share via


DAX - Calculate based on current row value

Question

Thursday, September 25, 2014 9:11 AM

Just trying to learn DAX so apologies if the answer to this question 

Would like to calculate a Count based on a column value per row. See an example.

In this example, I want to know how many items where created before or during the closed date of the current row. The calculation is giving me unexpected results however. What am I doing wrong? What should I do?

All replies (2)

Thursday, September 25, 2014 1:10 PM âś…Answered

This calculation should be what you are looking for

(replace 'Table1' with the name of your table in your model)

=COUNTX(Filter('Table1', [Created]<=Earlier([Closed]) ), [Created])

If you wanted it between the created and closed dates, then the following adds another filter to the table.

=COUNTX(Filter('Table', [Created] >= Earlier([Created]) && [Created]<=Earlier([Closed]) ), [Created])


Thursday, September 25, 2014 3:32 PM

Thank you, this is what I was looking for.