• 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
    • Password Reset
  • Blog
  • Excel Webinars
  • Excel Forum
    • Register as Forum Member

Power Pivot|Power Pivot|Excel Forum|My Online Training Hub

You are here: Home / Power Pivot|Power Pivot|Excel Forum|My Online Training Hub
Avatar
sp_LogInOut Log In sp_Registration Register
sp_Search Search
Advanced Search|Last Search Results
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 PivotPower Pivot
sp_PrintTopic sp_TopicIcon
Power Pivot
Avatar
Andrea Garay

Active Member
Members
Level 0
Forum Posts: 4
Member Since:
May 9, 2020
sp_UserOfflineSmall Offline
1
May 9, 2020 - 5:55 am
sp_Permalink sp_Print

I have a power pivot to with daily sales tables and date reference table. The user inputs the date and I need to add a column that calculate the sales to that date. The date is refreshing to the date reference table and my formula is:

=if(Sales_report_[Doc_Date]<=RELATED('Date Reference'[Date]),Sales_report_[Gross Sales],0)

So in the above I need gross sales amount to show if the date of the sales (Doc_Date) is less or equal to the date on the reference table (Date Reference'[Date]); otherwise, show 0. 

 

It is working but only shows gross sales for the dates within the same month. In other words, if the date reference is 02/28/2019 then it shows gross sales only for the rows within February 2019 but not January 2019. It is like not including the entire month in the if formula. 

Avatar
Mynda Treacy
Admin
Level 10
Forum Posts: 4443
Member Since:
July 16, 2010
sp_UserOfflineSmall Offline
2
May 9, 2020 - 10:16 am
sp_Permalink sp_Print

Hi Andrea,

Remember DAX measures also use row and column context to filter. Do you have any month/date fields in the PivotTable that could be applying the filter to only show February data?

Mynda

Avatar
Andrea Garay

Active Member
Members
Level 0
Forum Posts: 4
Member Since:
May 9, 2020
sp_UserOfflineSmall Offline
3
May 11, 2020 - 11:01 pm
sp_Permalink sp_Print

Yes, I'm comparing to a date. The data model has a date reference table that populates from the user input on the spreadsheet. 

 

=if(Sales_report_[Doc_Date]<=RELATED('Date Reference'[Date]),Sales_report_[Gross Sales],0)

 

The formula is looking to the 'Date Reference'[Date] table.  

Avatar
Andrea Garay

Active Member
Members
Level 0
Forum Posts: 4
Member Since:
May 9, 2020
sp_UserOfflineSmall Offline
4
May 12, 2020 - 12:13 am
sp_Permalink sp_Print

The formula is working. However, it will only give me the rows for the same month. In other words, it will show only April for example if the date reference= 04/30/2020 but the formula is to show less or equal to April 30, 2020 so I'm expecting January 1 thru April 30th to show.  

Avatar
Mynda Treacy
Admin
Level 10
Forum Posts: 4443
Member Since:
July 16, 2010
sp_UserOfflineSmall Offline
5
May 12, 2020 - 9:12 pm
sp_Permalink sp_Print

Hi Andrea,

You haven't answered my question. I asked what fields you have in your PivotTable that contain a date. It would help if you shared your file or at least some screenshots.

Mynda

Avatar
Andrea Garay

Active Member
Members
Level 0
Forum Posts: 4
Member Since:
May 9, 2020
sp_UserOfflineSmall Offline
6
May 13, 2020 - 2:02 am
sp_Permalink sp_Print

attached file with screenshots. 

sp_Feed
Go to top
Forum Timezone: Australia/Brisbane
Most Users Ever Online: 245
Currently Online: Genevieve Guex, Richard Benson-King, Janset Beyaz
Guest(s) 9
Currently Browsing this Page:
1 Guest(s)
Top Posters:
SunnyKow: 1432
Anders Sehlstedt: 870
Purfleet: 412
Frans Visser: 346
David_Ng: 306
lea cohen: 219
A.Maurizio: 202
Jessica Stewart: 202
Aye Mu: 201
jaryszek: 183
Newest Members:
wahab tunde
Cong Le Duc
Faisal Bashir
Ivica Cvetkovski
Blaine Cox
Shankar Srinivasan
riyepa fdgf
Hannah Cave
Len Matthews
Kristine Arthy
Forum Stats:
Groups: 3
Forums: 24
Topics: 6205
Posts: 27209

 

Member Stats:
Guest Posters: 49
Members: 31878
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.