Forum Discussion

zfemmer's avatar
zfemmer
Icon for Helper I rankHelper I
5 years ago
Solved

Dax - Period To Date This Week Vs. Last Week

I am trying to have a line graph that displays last week's revenue and this week's revenue period to date.

I have figured out this week with this:

VAR _PeriodToDate =
CALCULATE(
    SUM(RevenueChannel[BookedRevenue]),
    'Date'[Date] <= _MaxDate,
        FILTER(ALL('Date'),
        'Date'[Date] < TODAY() &&
        'Date'[Date] >= TODAY() - 7
        )
)

 

But cannot seem to figure out how to do the last week. I know I can easily just do this:

VAR _PeriodToDateTest =
CALCULATE(
    SUM(RevenueChannel[BookedRevenue]),
    'Date'[Date] <= _MaxDate,
        FILTER(ALL('Date'),
        'Date'[Date] < TODAY() - 7 &&
        'Date'[Date] >= TODAY() - 14
        )
)

 

But then they do not line up on the line graph:

Does anyone know how I would accomplish this?

  • I was way overthinking it...

    CALCULATE(
        SUM(RevenueChannel[BookedRevenue]),
        'Date'[Date] <= _MaxDate - 7,
            FILTER(ALL('Date'),
            'Date'[Date] < TODAY() - 7 &&
            'Date'[Date] >= TODAY() - 14
            )
    )

1 Reply

  • I was way overthinking it...

    CALCULATE(
        SUM(RevenueChannel[BookedRevenue]),
        'Date'[Date] <= _MaxDate - 7,
            FILTER(ALL('Date'),
            'Date'[Date] < TODAY() - 7 &&
            'Date'[Date] >= TODAY() - 14
            )
    )