Greetings!
I've been working on a model that has been discussed on this board here. This is not to do with the model itself, but rather something I've come across that is a more general DAX question. I am posting it separately given there is a lot of detail in the other thread that I don't want people to think they need in order to assist with this.
Everything goes amazingly well in my model until I add the following DAX Measure:
fCradle is about 50,000 rows.
Every other table referenced here is not very big at all:
I recently rebuilt the model from scratch and noted when it started to take a much longer time than I'd expect when adding a measure. The above is the first time it happens (downstream measures depend on it) and I am curious as to why. It doesn't seem particularly complex, the tables are not huge in terms of records. The model would seem to be very efficient given the sizes and relationships. It's basically a Star Schema with only dWeekBreakdown being related to dDate before fCradle.
I did research on DISTINCTCOUNT and it seems like a perfectly fine measure so I am guessing it has something to do with the RELATED function and trying to discern if a value is between two dates? If so, is there any other way to do this? It takes the model like 20-40 seconds when I add it to a pivot table and it's driving me crazy. Had I not used PowerPivot, it'd be much faster using lookups, even in the fact table.
Any ideas?
Thanks in advance for viewing!
I've been working on a model that has been discussed on this board here. This is not to do with the model itself, but rather something I've come across that is a more general DAX question. I am posting it separately given there is a lot of detail in the other thread that I don't want people to think they need in order to assist with this.
Everything goes amazingly well in my model until I add the following DAX Measure:
Code:
=CALCULATE(
DISTINCTCOUNT(fCradle[Date]),
FILTER (
fCradle,
fCradle[Total hours] <> 0 && fCradle[Date] >= RELATED ( dStaffList[Hire Date] ) && fCradle[Date] <= RELATED ( dStaffList[Term Date] )
)
)
fCradle is about 50,000 rows.
Every other table referenced here is not very big at all:
- dStaffList is 122 records
- dDate (official Calendar Table) is 368 records
- dTimeType is 186 records
- dWeekBreakdown (related to dDate) is 54 records
I recently rebuilt the model from scratch and noted when it started to take a much longer time than I'd expect when adding a measure. The above is the first time it happens (downstream measures depend on it) and I am curious as to why. It doesn't seem particularly complex, the tables are not huge in terms of records. The model would seem to be very efficient given the sizes and relationships. It's basically a Star Schema with only dWeekBreakdown being related to dDate before fCradle.
I did research on DISTINCTCOUNT and it seems like a perfectly fine measure so I am guessing it has something to do with the RELATED function and trying to discern if a value is between two dates? If so, is there any other way to do this? It takes the model like 20-40 seconds when I add it to a pivot table and it's driving me crazy. Had I not used PowerPivot, it'd be much faster using lookups, even in the fact table.
Any ideas?
Thanks in advance for viewing!
Last edited: