Forum Discussion

tools12345's avatar
tools12345
Icon for Helper I rankHelper I
4 years ago
Solved

How to set value in card based on week value

Hi everyone here in the community, we would like to ask for your insights and help, we have a specific card and a slicer with week. One requirement is that we should be able to display the current we...
  • tamerj1's avatar
    4 years ago

    Hi tools12345 
    Here is th sample file with the solution https://we.tl/t-NAIGSrO6ds

     

    Selected Week Value = 
    VAR SelectedWeek = COALESCE ( SELECTEDVALUE ( data1[Week] ), WEEKNUM ( TODAY ( ) ) - 1 )
    VAR Result =
        CALCULATE ( 
            SUM ( data1[Account Payables] ),
            data1[Week] = SelectedWeek
        )
    RETURN
        COALESCE ( Result, 0 )

     

  • Jihwan_Kim's avatar
    Jihwan_Kim
    4 years ago

    Hi,

    Thank you very much for your message.

    Please try the below measure for replacing Blank with zero.

     

    expected outcome: = 
    VAR _thisweeknumber =
        WEEKNUM ( TODAY (), 21 )
    RETURN
        IF (
            ISFILTERED ( date_2022[Week of Year] ),
            SUM ( data1[Account Payables] ),
            CALCULATE (
                SUM ( data1[Account Payables] ),
                FILTER ( data1, data1[Week] = _thisweeknumber )
            )
        ) + 0