Forum Discussion
% Days Complete DAX
- 8 years ago
Hi Anonymous,
Please use the following formula.Measure = VAR Select_mon = SELECTEDVALUE ( Calendario[month] ) VAR Actual_mon = MONTH ( TODAY () ) RETURN SWITCH ( TRUE (), Actual_mon > Select_mon, 1, Actual_mon < Select_mon, 0, DIVIDE ( DAY ( TODAY () ), CALCULATE ( COUNTROWS ( 'Calendar' ), FILTER ( ALL ( 'Calendar' ), 'Calendar'[Year] = YEAR ( TODAY () ) && 'Calendar'[Month Number] = MONTH ( TODAY () ) ) ) ) )
Best Regards,
Angelia
Hi Anonymous,
You create a calculated measure, right? You should understand the difference between the Measure and Calculated Column. The measure returns a value, while Calculated Column returns a column. The Calculation you are trying to achieve is more suitable for calculated column, change to a calculated column and check if it works fine. Please connect me if there's any issue.
Thanks,
Angelia
I have changed this measure to a column, but am still getting the wrong value.
What am I doing wrong?
% Days Test =
var totalDays =
CALCULATE(
COUNTROWS( DateDimension
),
FILTER(
ALL( DateDimension
),
DateDimension[Year] = YEAR( TODAY() ) && DateDimension[Month] = MONTH( DateDimension[Date] )
)
)
var days =DAY(TODAY())
RETURN DIVIDE( days, totalDays )