Wednesday, April 22, 2020

HOW TO FIND SUM OF LAST 5 MONTHS CUMULATIVE SALES


How to calculate last 5 months cumulative sales?

LAST 5 MONTHS CUMULATIVE SALES =
CALCULATE (
    [Total sales],
    DATESINPERIOD (
        DimDate[FullDateAlternateKey],
        LASTDATE ( DimDate[FullDateAlternateKey] ),
        -5,
        MONTH
    )
)

syntax DATESINPERIOD

DATESINPERIOD(<dates>,<start_date>,<number_of_intervals>,<interval>)

we can also find last X months average by using the above function.

No comments:

Post a Comment

Sort by Month and year in the table

  Solved: Sort by month in Power BI - Microsoft Power BI Community