cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
dentonblake Regular Visitor
Regular Visitor

Calculate Trailing 12-months when only all 12 months have data

Power BI Maestros:

 

Thanks to the help of this forum, I have a measure which calculates trailing 12-months of sales (see below), however, seeking guidance on how I can edit measure so that it only returns sales data where there's a complete 12-months of sales (i.e., if a restaurant only has 6 months of trailing sales then it would be null).  Thank you, ~db

 

Cumulative_Sales = CALCULATE(
    if(
        countrows(values('DATE'[Date])) = 1,
        [TABC_SALES],
        SUMX(
            values('DATE'[Date]),
            [TABC_SALES]
        )
    ),
    DATESINPERIOD(
        'DATE'[Date],
        LASTDATE('DATE'[Date]),
        -12,
        MONTH
    )
)

1 ACCEPTED SOLUTION

Accepted Solutions
Super User
Super User

Re: Calculate Trailing 12-months when only all 12 months have data

Hi @dentonblake,

 

Share the link from where i can download your PBI file.

4 REPLIES 4
avisingh Regular Visitor
Regular Visitor

Re: Calculate Trailing 12-months when only all 12 months have data

Denton,

 

I recorded a video message for you :-)
https://youtu.be/ojcqKTP3VYc (see also, file attached)

 

⚡Power On!⚡
-Avi Singh. Microsoft MVP. PowerBIPro

Power BI Tutorial for Beginners (Step-by-Step) and more on YouTube.com/PowerBIPro

Super User
Super User

Re: Calculate Trailing 12-months when only all 12 months have data

Hi @dentonblake,

 

Share the link from where i can download your PBI file.

Highlighted
dentonblake Regular Visitor
Regular Visitor

Re: Calculate Trailing 12-months when only all 12 months have data

Thank you, Ashish - apologize for the long delay in expressing gratitude for your assistnace.  ~db

Super User
Super User

Re: Calculate Trailing 12-months when only all 12 months have data

You are welcome.