@adsa
Can you upload some sample data? At first glance I think using EXCEPT in a calculated table would be the way to go, but that’s just guess w/o seeing any data.
@adsa
Is there a dimension (lookup) table for Tasks? I believe the end goal is:
So my initial thinking here is get the Tasks on rows Date as a slicer to get the initial context. Then from there we can see which task are and aren’t there and all of that. But want to be sure this first step is squared away before diving in.
Putting Task Name (From Dim TaskName) and Date from Dates in the matrix. I used this function
Total Working Days from Created to Completed =
/* Variable to set the Completed date to either what is in the table, or if there is no value use today's date*/
VAR __CompletedDate=
IF( ISBLANK([Task Completed Date]),TODAY(),[Task Completed Date])
/* This tells us the created date, our starting point to count how many days have elapsed*/
VAR __CreatedDate=
CALCULATE( MAX( AcquisitionsThreads[TaskCreatedDate]))
RETURN
IF(
COUNTROWS(AcquisitionsThreads), --Checks to see if there is data, else would produce a value for every date
CALCULATE(
DISTINCTCOUNT(AcquisitionsThreads[TaskID]), --We start by wanting to count the # of unique tasks
DATESBETWEEN(Dates[Date],__CreatedDate, __CompletedDate), --Filter using dates between, which is why used the variables aboe
Dates[IsworkingDay] = 1, --Then only want to use working days, not every available date
DimTaskStatus[TaskStatus]="Unactioned" --Then also only interested in Unactioned tasks
)
)
In this small data model you could probably get away with it. But it always best practive to breakout your tables into Fact (where the aggregations comes from) and Dimension( where the filters would come from). There are a few reasons:
This will help create a star schema, which DAX is optimized for
This will help keep things organized
Your Dimension tables would probably have more than just one value ( like Task A in this situation). It would have something like Task A, Task Name, Task Subname, etc. Then you can slice by any value in the dimension
When using FILTER in a function, FILTER is an iterator and being an interator you never want to iterate your bigger fact table. You want to iterate the smaller dimension table and then “Send” that filter to your fact tables and then your aggregator will create a final figure based on that.
I’m, sure there is more but that’s the general idea. Hope that helps!