Forum Discussion
rpinxt
2 years agoSolution Sage
Circular dependency.....why???
So I have this calculated column returning a nummber : HourDiff = VAR _StartDay = SC2[D1] VAR _EndDay = SC2[D2] VAR _Correction = IF(_EndDay = 1 && _StartDay < 6 && _StartDay <> 1, ...
- 2 years ago
Your calendar table is derived from your fact table. That is akin to using CALENDARAUTO, and is Very Bad Indeed.
Overcome the urge to create calendar scripts in DAX or Power Query. They are useless. Use an external reference table.
You also don't need to specify table names in calculated columns.
rpinxt
2 years agoSolution Sage
Ok officially am losing my mind now 😂
So this was the logic in field 'Timer' that led to the circular:
Timing =
VAR _HourDiff = CALCULATE(DIVIDE(DATEDIFF(MAX(SC2[DT101]),MAX(SC2[DT311]),MINUTE),60))
VAR weekend = CALCULATE(COUNTROWS(dimDate),DATESBETWEEN(dimDate[Date],SC2[DT101],SC2[DT311] -1),dimDate[IsWorkingDay] = FALSE(),ALL(dimDate))
VAR correction = IF(weekend > 1, 48, 0)
RETURN
IF(_HourDiff - correction > 24,"Late","On Time")
Now I copy it over with the logic in the sample file :
Timing =
VAR _HourDiff = CALCULATE(DIVIDE(DATEDIFF(MAX(SC2[DT101]),MAX(SC2[DT311]),MINUTE),60))
VAR weekend = CALCULATE(COUNTROWS(dimDate),DATESBETWEEN(dimDate[Date],SC2[DT101],SC2[DT311] -1),dimDate[IsWorkingDay] = FALSE(),ALL(dimDate))
VAR correction = IF(weekend > 1, 48, 0)
RETURN
IF(_HourDiff - correction > 24,"Late","On Time")
And of course....gone is the circular and also the sigma changed into an fx....
Perhaps I am looking already to long at this, but to me that is twice the same logic.
So why the orginal one was not working beats me....
Anyway all good now lbendlin . Somehow it is al working now.
Thanks!