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.
This is a representaion of the Excel Table. I'll followup with two more posts showing the Power Query side.
This shows the results from the slicer in Power Query.
- Barry_Kelly9 years agoNew Member
The question is how to use the results from the parameter table in the Date.IsInPreviousNDays function.- MarcelBeug9 years agoCommunity Champion
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.