Forum Discussion
Help with measure
- 6 years ago
Hi linusb ,
Maybe you can do like this.
Create a calculated column like this and use hierarchical slicer.
Mark the current weeknum = VAR x = WEEKNUM( TODAY(), 2 ) RETURN IF( x = [Weeknum], "Current weeknum", "Other weeknum" )After you set the default option of the slicer, as the data is updated, the default option of the slicer is always the current week number.
Best regards,
Lionel ChenIf this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Thanks for the replys.
This solution almost does the trick. The problem is, that I want the "Selected Week" to be the current week, when no weeknum is selected.
If I have a variable that I want to use in serveral measures, is it better to create the variable as it's own measure or define it as "local" variable in each measure?
I've also tried using:
Selected Week = SELECTEDVALUE(Dates[Weeknum])
Available Capacity Include Past =
CALCULATE([Remaining Manuf Time],
FILTER(ALL(Dates),
Dates[Weeknum] <= [Selected Week])
)
)This gives my the wrong result (always 16676,75 not matter what week I select) 16677 equals the total amount of remaining manufacturing time, calculated by the measure [Remaining Manuf Time].
If I merge [Selected Week] into the measure:
Available Capacity Include Past =
CALCULATE([Remaining Manuf Time],
FILTER(ALL(Dates),
Dates[Weeknum] <= SELECTEDVALUE(Dates[Weeknum])
)
)Then the measure will calculate the correct values.
I don't understand, why this is happening.
Best regards,
// Linus
Hi linusb ,
Maybe you can do like this.
Create a calculated column like this and use hierarchical slicer.
Mark the current weeknum =
VAR x = WEEKNUM( TODAY(), 2 )
RETURN
IF(
x = [Weeknum],
"Current weeknum",
"Other weeknum"
)
After you set the default option of the slicer, as the data is updated, the default option of the slicer is always the current week number.
Best regards,
Lionel Chen
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.