• Skip to main content
  • Skip to header right navigation
  • Skip to site footer

My Online Training Hub

Learn Dashboards, Excel, Power BI, Power Query, Power Pivot

  • Courses
  • Pricing
    • Free Courses
    • Power BI Course
    • Excel Power Query Course
    • Power Pivot and DAX Course
    • Excel Dashboard Course
    • Excel PivotTable Course – Quick Start
    • Advanced Excel Formulas Course
    • Excel Expert Advanced Excel Training
    • Excel Tables Course
    • Excel, Word, Outlook
    • Financial Modelling Course
    • Excel PivotTable Course
    • Excel for Customer Service Professionals
    • Excel for Operations Management Course
    • Excel for Decision Making Under Uncertainty Course
    • Excel for Finance Course
    • Excel Analysis ToolPak Course
    • Multi-User Pricing
  • Resources
    • Free Downloads
    • Excel Functions Explained
    • Excel Formulas
    • Excel Add-ins
    • IF Function
      • Excel IF Statement Explained
      • Excel IF AND OR Functions
      • IF Formula Builder
    • Time & Dates in Excel
      • Excel Date & Time
      • Calculating Time in Excel
      • Excel Time Calculation Tricks
      • Excel Date and Time Formatting
    • Excel Keyboard Shortcuts
    • Excel Custom Number Format Guide
    • Pivot Tables Guide
    • VLOOKUP Guide
    • ALT Codes
    • Excel VBA & Macros
    • Excel User Forms
    • VBA String Functions
  • Members
    • Login
  • Blog
  • Excel Webinars
  • Excel Forum
    • Register as Forum Member

DAX - Rolling 12 Mo.:FIND FIRST YR WITH DATA|Power Pivot|Excel Forum|My Online Training Hub

You are here: Home / DAX - Rolling 12 Mo.:FIND FIRST YR WITH DATA|Power Pivot|Excel Forum|My Online Training Hub

vba course banner

Avatar
sp_LogInOut Log In sp_Registration Register
sp_Search Search
Advanced Search
Search
Forum Scope




Match



Forum Options



Minimum search word length is 3 characters - maximum search word length is 84 characters
sp_Search Search
sp_RankInfo
Lost password?
sp_CrumbsHome HomeExcel ForumPower PivotDAX - Rolling 12 Mo.:FIND FIRST YR …
sp_PrintTopic sp_TopicIcon
DAX - Rolling 12 Mo.:FIND FIRST YR WITH DATA
Avatar
Harry Millikin

Active Member
Members

Power BI
Level 0
Forum Posts: 5
Member Since:
July 24, 2014
sp_UserOfflineSmall Offline
1
April 20, 2019 - 11:53 pm
sp_Permalink sp_Print

Hi Mynda...

I am wanting to calculate a rolling 12 month (Moving Average). I found this formula (see below) and thought it would work. The if statement removes the first 12 months so that the MA calculation includes 12 months, and removes dates that have not occurred yet. The IF statement assumes all the data starts in the same year. I filter my by different regions and the starting dates are different. Some start in 2013. Others start in 2015, etc. They all start at the beginning of the year (Jan).

I have tried multiple times to change the IF statement. I highlighted in RED where I think my problem is. What I am trying to do is to find the first date with data then find the year value and add one year. So...if the first date with data is 01/01/2016 then I want to only calculate the MA from 01/01/2017 to current date.

Thanks in advance. And, Happy Easter!

Kind regards,

...Harry

 

R12RTOT:=IF (

    AND (

        SUM ( 'Rome Data'[Revenue] ) > 0,

        MAX ( 'Date Table'[Year] )

            > CALCULATE ( MIN ( 'Date Table'[Year] ), ALL ( 'Date Table'[Year] ) )

    ),

    CALCULATE (

        SUM ( 'Rome Data'[Revenue] ),

        DATESINPERIOD ( 'Date Table'[Date], LASTDATE ( 'Date Table'[Date] ), -1, YEAR )

    )

)

Avatar
Catalin Bombea
Iasi, Romania
Admin
Level 10
Forum Posts: 1826
Member Since:
November 8, 2013
sp_UserOfflineSmall Offline
2
April 24, 2019 - 1:41 am
sp_Permalink sp_Print

Hi Harry,

try to build test measures and display them in pivot.

For example:

Test1:=MAX ( 'Date Table'[Year] )

Test2:=CALCULATE ( MIN ( 'Date Table'[Year] ), ALL ( 'Date Table'[Year] ) )

Once you display them side by side in your pivot, you will be able to understand where the problem is.

sp_Feed
Go to top
Forum Timezone: Australia/Brisbane
Most Users Ever Online: 245
Currently Online: David du Toit
Guest(s) 9
Currently Browsing this Page:
1 Guest(s)
Top Posters:
SunnyKow: 1432
Anders Sehlstedt: 873
Purfleet: 414
Frans Visser: 346
David_Ng: 306
lea cohen: 222
Jessica Stewart: 218
A.Maurizio: 202
Aye Mu: 201
jaryszek: 183
Newest Members:
Aminu Sule
Samuel Ramirez
Abdifatah Osman
mohad borhom
Abayomi Adedeji
Ganesh MVS
Gilbert Lemek
Ashleigh Farquharson
Jayz Luu
Fred Smith
Forum Stats:
Groups: 3
Forums: 24
Topics: 6364
Posts: 27829

 

Member Stats:
Guest Posters: 49
Members: 32346
Moderators: 3
Admins: 4
Administrators: Mynda Treacy, Philip Treacy, Catalin Bombea, FT
Moderators: MOTH Support, Velouria, Riny van Eekelen
© Simple:Press —sp_Information

Sidebar

Blog Categories

  • Excel
  • Excel Charts
  • Excel Dashboard
  • Excel Formulas
  • Excel PivotTables
  • Excel Shortcuts
  • Excel VBA
  • General Tips
  • Online Training
  • Outlook
  • Power Apps
  • Power Automate
  • Power BI
  • Power Pivot
  • Power Query
microsoft mvp logo
trustpilot excellent rating
Secured by Sucuri Badge
MyOnlineTrainingHub on YouTube Mynda Treacy on Linked In Mynda Treacy on Instagram Mynda Treacy on Twitter Mynda Treacy on Pinterest MyOnlineTrainingHub on Facebook
 

Company

  • About My Online Training Hub
  • Disclosure Statement
  • Frequently Asked Questions
  • Guarantee
  • Privacy Policy
  • Terms & Conditions
  • Testimonials
  • Become an Affiliate

Support

  • Contact
  • Forum
  • Helpdesk - For Technical Issues

Copyright © 2023 · My Online Training Hub · All Rights Reserved. Microsoft and the Microsoft Office logo are trademarks or registered trademarks of Microsoft Corporation in the United States and/or other countries. Product names, logos, brands, and other trademarks featured or referred to within this website are the property of their respective trademark holders.