To get Previous Week value in tabular

KamiFen 121 Reputation points
2020-09-30T07:53:29.987+00:00

I am trying to create a previous week data for my tabular project.

As titled, I am having a difficult time getting formula right.

How do i write some DAX to sum a total for the previous week?

I have all the others down YTD, WTD, MTD etc.

SQL Server Analysis Services
SQL Server Analysis Services
A Microsoft online analytical data engine used in decision support and business analytics, providing the analytical data for business reports and client applications such as Power BI, Excel, Reporting Services reports, and other data visualization tools.
1,255 questions
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. Lukas Yu -MSFT 5,816 Reputation points
    2020-09-30T08:40:48.73+00:00

    Hi,

    You could try this :

    Previous Week Total =  
    CALCULATE (  
        SUM ( Table[Amount] ),  
        FILTER (  
            ALL ( Table ),  
            Table[Year] = MAX ( Table[Year] )  
                && Table[WeekNumber]  
                    = MAX ( Table[WeekNumber] ) - 1  
        )  
    )  
    

    See if it works.
    Regards,
    Lukas


    If the answer is helpful, please click "Accept Answer" and upvote it.

    Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.