Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
dentonblake
Helper II
Helper II

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
Ashish_Mathur
Super User
Super User

Hi @dentonblake,

 

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


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/

View solution in original post

4 REPLIES 4
Ashish_Mathur
Super User
Super User

Hi @dentonblake,

 

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


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/

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

You are welcome.


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/

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

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.