Forum Discussion
Date.IsInPreviousNDays M code question
- 9 years ago
You can either:
Add 1 step to your first query: select the value, so the output of the query will be 1 value and you can replace the 2 in your function by <NameOfYourFirstQuery>.
Or
Replace the value 2 in your function by: Table.FirstValue(<NameOfYourFirstQuery>).
I would prefer the first option.
The question is how to use the results from the parameter table in the Date.IsInPreviousNDays function.
You can either:
Add 1 step to your first query: select the value, so the output of the query will be 1 value and you can replace the 2 in your function by <NameOfYourFirstQuery>.
Or
Replace the value 2 in your function by: Table.FirstValue(<NameOfYourFirstQuery>).
I would prefer the first option.
- Barry_Kelly9 years agoNew Member
Thank you very much!! I could not get your first solution to work and was working on an approach to include a "Let" statement.
The Table.FirstValue works in the let statement. No doubt this approach can be improved upon but I now have a simple solution that allows the user to dynamically change the Power Query results. - MarcelBeug9 years agoCommunity Champion
Glad your issue is solved. :smileyhappy:
Sorry I forgot to mention with my first option: you should right-click the value in the table (in the Query Editor) and choose "Drill down" from the menu.