Forum Discussion

totamum's avatar
totamum
Helper I
1 year ago
Solved

Create Card Showing Latest Value

I'm trying to create a Card which will display the latest Week on Week percentage that I have calculated.  My table is below.  The columns are measures based on other data.  I would like to show the ...
  • Jihwan_Kim's avatar
    1 year ago

    Hi, 
    I am not 100% sure how your semantic model looks like, but I tried to create a sample pbix file like below.

    Please check the below picture and the attached pbix file.

     

     

     

    users: = 
    SUM( users[users] )

     

    OFFSET function (DAX) - DAX | Microsoft Learn

     

    Previous week users: = 
    IF (
        NOT ISBLANK ( [users:] ),
        CALCULATE (
            [users:],
            OFFSET ( -1, ALL ( period[week] ), ORDERBY ( period[week], ASC ) )
        )
    )

     

    WoW %: = 
    DIVIDE([users:]-[Previous week users:], [Previous week users:])

     

    Latest WoW%: = 
    VAR _t =
        FILTER (
            ADDCOLUMNS ( ALL ( period[week] ), "@wow%", [WoW %:] ),
            [@wow%] <> BLANK ()
        )
    VAR _latestweeknumber =
        MAXX ( _t, period[week] )
    RETURN
        CALCULATE ( [WoW %:], KEEPFILTERS ( period[week] = _latestweeknumber ) )