I'm new to much of this, so please bear with me. . . I'm trying create a count of active projects by week using projects' start and end dates. I've created a COUNTIFS formula in an Excel worksheet table that works, but I would prefer the calculated column reside in my Data Model/PowerPivot. This should be relatively simple, but being the complete novice that I am, I can't seem to come up with a "DAX" version of the formula. I've tried using COUNT/CALCULATE/FILTER, but I can't seem to get the syntax right. Hoping someone can help!! Thanks!
This is what I came up with in the Excel table:
This is the sample data I've been working with to test my options - The "Weekly Count" column is where my Excel formula currently resides:
[TABLE="width: 500"]
<colgroup><col><col><col><col><col></colgroup><tbody>[TR]
[TD]Project Name[/TD]
[TD]Start Date[/TD]
[TD]End Date[/TD]
[TD]End of Week[/TD]
[TD]Weekly Count[/TD]
[/TR]
[TR]
[TD]Project1[/TD]
[TD]12/1/2017[/TD]
[TD]3/1/2018[/TD]
[TD]12/2/2017[/TD]
[TD]1[/TD]
[/TR]
[TR]
[TD]Project2[/TD]
[TD]12/4/2017[/TD]
[TD]3/4/2018[/TD]
[TD]12/9/2017[/TD]
[TD]1[/TD]
[/TR]
[TR]
[TD]Project3[/TD]
[TD]12/16/2017[/TD]
[TD]3/16/2018[/TD]
[TD]12/16/2017[/TD]
[TD]1[/TD]
[/TR]
[TR]
[TD]Project4[/TD]
[TD]12/18/2017[/TD]
[TD]3/18/2018[/TD]
[TD]12/23/2017[/TD]
[TD]1[/TD]
[/TR]
[TR]
[TD]Project5[/TD]
[TD]12/20/2017[/TD]
[TD]3/20/2018[/TD]
[TD]12/23/2017[/TD]
[TD]1[/TD]
[/TR]
[TR]
[TD]Project6[/TD]
[TD]12/21/2017[/TD]
[TD]3/21/2018[/TD]
[TD]12/23/2017[/TD]
[TD]1[/TD]
[/TR]
[TR]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
</tbody>[/TABLE]
This is what I came up with in the Excel table:
Code:
=COUNTIFS([@[Start Date]],"<="&[@[End of Week]],[@[End Date]],">="&[@[End of Week]])
This is the sample data I've been working with to test my options - The "Weekly Count" column is where my Excel formula currently resides:
[TABLE="width: 500"]
<colgroup><col><col><col><col><col></colgroup><tbody>[TR]
[TD]Project Name[/TD]
[TD]Start Date[/TD]
[TD]End Date[/TD]
[TD]End of Week[/TD]
[TD]Weekly Count[/TD]
[/TR]
[TR]
[TD]Project1[/TD]
[TD]12/1/2017[/TD]
[TD]3/1/2018[/TD]
[TD]12/2/2017[/TD]
[TD]1[/TD]
[/TR]
[TR]
[TD]Project2[/TD]
[TD]12/4/2017[/TD]
[TD]3/4/2018[/TD]
[TD]12/9/2017[/TD]
[TD]1[/TD]
[/TR]
[TR]
[TD]Project3[/TD]
[TD]12/16/2017[/TD]
[TD]3/16/2018[/TD]
[TD]12/16/2017[/TD]
[TD]1[/TD]
[/TR]
[TR]
[TD]Project4[/TD]
[TD]12/18/2017[/TD]
[TD]3/18/2018[/TD]
[TD]12/23/2017[/TD]
[TD]1[/TD]
[/TR]
[TR]
[TD]Project5[/TD]
[TD]12/20/2017[/TD]
[TD]3/20/2018[/TD]
[TD]12/23/2017[/TD]
[TD]1[/TD]
[/TR]
[TR]
[TD]Project6[/TD]
[TD]12/21/2017[/TD]
[TD]3/21/2018[/TD]
[TD]12/23/2017[/TD]
[TD]1[/TD]
[/TR]
[TR]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
</tbody>[/TABLE]