Forum Discussion
Anonymous
7 years agoNot applicable
Edit current DAX Time date Demission for current Year only
Hi Experts
How would i amend the current DAX so it applies aonly to the current year in question.
WorkingDays =
VAR CWD = CALCULATE(COUNT(DimDate[Date]),FILTER(DimDate,DimDate[Weekday] <> 0 && DimDate[Weekday] <> 6 && VALUE(DimDate[Month]) = MONTH(EARLIER('Taiwan Calendar'[Date]))))
VAR Hol = CALCULATE(COUNT('Taiwan Calendar'[Date]),FILTER(ALL('Taiwan Calendar'),MONTH('Taiwan Calendar'[Date])=MONTH(EARLIER('Taiwan Calendar'[Date])) && 'Taiwan Calendar'[Country] = EARLIER('Taiwan Calendar'[Country]) && 'Taiwan Calendar'[Weekday] <> "Saturday" && 'Taiwan Calendar'[Weekday] <> "Sunday"))
RETURN CWD - HolHi Anonymous
To get the current year, you could create a column to obtain, when current year is 2018, it shows 2018, when current year is 2019, it shows 2019.
today's year = YEAR(TODAY())
Then add this condition in the "filter" of your each formula
CWD =
CALCULATE (
COUNT ( DimDate[Date] ),
FILTER (
DimDate,
DimDate[Weekday] <> 0
&& DimDate[Weekday] <> 6
&& DimDate[Date].[Year] = DimDate[today's year]
)
)Best Regards
Maggie
2 Replies
- v-juanli-msft
Community Support
Hi Anonymous
To get the current year, you could create a column to obtain, when current year is 2018, it shows 2018, when current year is 2019, it shows 2019.
today's year = YEAR(TODAY())
Then add this condition in the "filter" of your each formula
CWD =
CALCULATE (
COUNT ( DimDate[Date] ),
FILTER (
DimDate,
DimDate[Weekday] <> 0
&& DimDate[Weekday] <> 6
&& DimDate[Date].[Year] = DimDate[today's year]
)
)Best Regards
Maggie
- AnonymousNot applicable
Thanks Maggie, excellent feedback.