• 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

How to reference a measure in M|Power Query|Excel Forum|My Online Training Hub

You are here: Home / How to reference a measure in M|Power Query|Excel Forum|My Online Training Hub

vba course banner

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 QueryHow to reference a measure in M
sp_PrintTopic sp_TopicIcon
How to reference a measure in M
Avatar
Simon Smith
Member
Members
Level 0
Forum Posts: 26
Member Since:
May 19, 2021
sp_UserOfflineSmall Offline
1
November 2, 2022 - 7:40 am
sp_Permalink sp_Print

I have a measure in a data model that returns the date of the oldest record in the data-set.

 

Manually I put this date in the following line of a query in the same data model (not the same query):

#"Filtered Rows" = Table.SelectRows(#"Changed Type1", each [Return Month] < #date(2018, 5, 1))

Is there a way to reference the output of the measure in the #date expression so that I don't need to key it manually? It's fine for me to do it, but my users really don't know how to open and edit M.

 

Many thanks for any help you can offer.

Lindsay

sp_AnswersTopicSeeAnswer See Answer
Avatar
Philip Treacy
Admin
Level 10
Forum Posts: 1529
Member Since:
October 5, 2010
sp_UserOfflineSmall Offline
2
November 2, 2022 - 9:28 am
sp_Permalink sp_Print

Hi Simon,

You say measure so you are talking about the result of a DAX calculation?

There's no way to refer to the measure from inside the PQ editor I'm afraid.

Can't you work out the date of the oldest record using PQ and get the value that way?

regards

Phil

sp_AnswersTopicAnswer
Answers Post
Avatar
Simon Smith
Member
Members
Level 0
Forum Posts: 26
Member Since:
May 19, 2021
sp_UserOfflineSmall Offline
3
November 2, 2022 - 11:37 pm
sp_Permalink sp_Print

Thanks Phil, I'll look at how to make your suggestion work.

All the best

Simon

Avatar
Simon Smith
Member
Members
Level 0
Forum Posts: 26
Member Since:
May 19, 2021
sp_UserOfflineSmall Offline
4
November 13, 2022 - 4:40 am
sp_Permalink sp_Print

Thank you for your help Phil.

It was so easy in PQ (once I explored and made a few howlers).

Duplicate the query generating the large data-set (call it 'Oldest_Record', delete all columns but the date column, sort on earliest, delete duplicates, drill down and change to text.

The query that I had been updating manually now becomes:

#"Filtered Rows" = Table.SelectRows(#"Changed Type1", each [Return Month] < Date.FromText((Oldest_Record)))

... so now I don't have to worry about my users editing a query - they just press a button.

It just goes to show, everything is easy, when you know the answer!

Much appreciated,

SimonLaugh

Avatar
Philip Treacy
Admin
Level 10
Forum Posts: 1529
Member Since:
October 5, 2010
sp_UserOfflineSmall Offline
5
November 14, 2022 - 11:02 am
sp_Permalink sp_Print

No worries Simon.  When you start using PQ a lot you see how awesome it is, it'll change your life.

regards

Phil

sp_Feed
Go to top
Forum Timezone: Australia/Brisbane
Most Users Ever Online: 245
Currently Online: Malcolm Sawyer
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: 216
A.Maurizio: 202
Aye Mu: 201
jaryszek: 183
Newest Members:
Melanie Ford
Isaac Felbah
Adele Glover
Hitesh Asrani
Rohan Abraham
Anthony van Riessen
Erlinda Eloriaga
Abisola Ogundele
MARTYN STERRY
Rahim Lakhani
Forum Stats:
Groups: 3
Forums: 24
Topics: 6355
Posts: 27792

 

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