Forum Discussion
NETWORKDAYS using Date VAR
- 1 year ago
Hi roehler
You don't need
SELECTEDVALUE.The calculated column expression is evaluated in the row context of the
Quarterstable, so you can reference columns of that table directly.WorkingDays = VAR StartDate = Quarters[StartDate] VAR EndDate = Quarters[EndDate] RETURN NETWORKDAYS ( StartDate, EndDate, 1, Holidays )
Hi roehler ,
Its likely due to the misuse of the SELECTEDVALUE function within a calculated column context. SELECTEDVALUE is best suited for measures or visuals where there's a specific filter context.
In a calculated column, each row already has direct access to its respective values, so there's no need to use SELECTEDVALUE. Instead, you can refer directly to the [StartDate] and [EndDate] columns.
Additionally, make sure that the Holidays table you're referencing is structured as a single-column table with proper date formatting. The corrected DAX should look like this:
WorkingDays =
NETWORKDAYS(Quarters[StartDate], Quarters[EndDate], 1, Holidays[Date])