Forum Discussion

AllanBerces's avatar
AllanBerces
Post Prodigy
9 months ago
Solved

No values Leesthan Current Week

Hi Can anyone help me on how can i hide the value on my cumulative if the week is lesssthan today.= base from my current calculated column

**bleep**/Earned =
CALCULATE(
SUM('Table'[Earned/BP]),
FILTER(
ALL('Table'),
'Table'[Area] = EARLIER('Table'[Area]) &&
'Table'[Subcon] = EARLIER('Table'[Subcon]) &&
'Table'[Week No.] <= EARLIER('Table'[Week No.])
)
)

RESULT DISIRED

Thank you



  • Hi AllanBerces,

    Your current DAX formula calculates the cumulative earned correctly but you need to add a condition to return BLANK() for future weeks...So could you try this modified Code:

    **bleep**/Earned =
    VAR CurrentWeek = WEEKNUM(TODAY(), 2) // Gets current week number (Monday as start day)
    RETURN
    IF(
        'Table'[Week No.] <= CurrentWeek,
        CALCULATE(
            SUM('Table'[Earned/BP]),
            FILTER(
                ALL('Table'),
                'Table'[Area] = EARLIER('Table'[Area]) &&
                'Table'[Subcon] = EARLIER('Table'[Subcon]) &&
                'Table'[Week No.] <= EARLIER('Table'[Week No.])
            )
        ),
        BLANK()
    )

     

    Alternative approach if you want more control over the current week reference:

    **bleep**/Earned =
    VAR CurrentWeek = 45 // Set this to your desired current week
    RETURN
    IF(
        'Table'[Week No.] <= CurrentWeek,
        CALCULATE(
            SUM('Table'[Earned/BP]),
            FILTER(
                ALL('Table'),
                'Table'[Area] = EARLIER('Table'[Area]) &&
                'Table'[Subcon] = EARLIER('Table'[Subcon]) &&
                'Table'[Week No.] <= EARLIER('Table'[Week No.])
            )
        ),
        BLANK()
    )

     

    This will give you the result shown in your desired output where weeks 46-52 show as blank instead of repeating the last cumulative value

     

    Note: The WEEKNUM(TODAY(), 2) assumes your week starts on Monday. Adjust the second parameter if your week starts on a different day:

    • 1 = Week starts Sunday
    • 2 = Week starts Monday
    • 11 = Monday (ISO standard)

    • 12 = Tuesday
    • etc...
    if this post helps, then I would appreciate a thumbs up and mark it as the solution to help the other members find it more quickly.

2 Replies

  • Hi AllanBerces,

    Your current DAX formula calculates the cumulative earned correctly but you need to add a condition to return BLANK() for future weeks...So could you try this modified Code:

    **bleep**/Earned =
    VAR CurrentWeek = WEEKNUM(TODAY(), 2) // Gets current week number (Monday as start day)
    RETURN
    IF(
        'Table'[Week No.] <= CurrentWeek,
        CALCULATE(
            SUM('Table'[Earned/BP]),
            FILTER(
                ALL('Table'),
                'Table'[Area] = EARLIER('Table'[Area]) &&
                'Table'[Subcon] = EARLIER('Table'[Subcon]) &&
                'Table'[Week No.] <= EARLIER('Table'[Week No.])
            )
        ),
        BLANK()
    )

     

    Alternative approach if you want more control over the current week reference:

    **bleep**/Earned =
    VAR CurrentWeek = 45 // Set this to your desired current week
    RETURN
    IF(
        'Table'[Week No.] <= CurrentWeek,
        CALCULATE(
            SUM('Table'[Earned/BP]),
            FILTER(
                ALL('Table'),
                'Table'[Area] = EARLIER('Table'[Area]) &&
                'Table'[Subcon] = EARLIER('Table'[Subcon]) &&
                'Table'[Week No.] <= EARLIER('Table'[Week No.])
            )
        ),
        BLANK()
    )

     

    This will give you the result shown in your desired output where weeks 46-52 show as blank instead of repeating the last cumulative value

     

    Note: The WEEKNUM(TODAY(), 2) assumes your week starts on Monday. Adjust the second parameter if your week starts on a different day:

    • 1 = Week starts Sunday
    • 2 = Week starts Monday
    • 11 = Monday (ISO standard)

    • 12 = Tuesday
    • etc...
    if this post helps, then I would appreciate a thumbs up and mark it as the solution to help the other members find it more quickly.