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

Earn the coveted Fabric Analytics Engineer certification. 100% off your exam for a limited time only!

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
April AMA free

Microsoft Fabric AMA Livestream

Join us Tuesday, April 09, 9:00 – 10:00 AM PST for a live, expert-led Q&A session on all things Microsoft Fabric!

March Fabric Community Update

Fabric Community Update - March 2024

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