Forum Discussion
ivorhooper
6 years agoNew Member
Relative Date in Query Parameter
Hi All, im not sure of the correct terms to describe what i am doing, but here goes... In Power BI desktop, I am connecting to a SAP Business Warehouse query as my input data. (SapBusinessWar...
- 6 years ago
Hi ivorhooper
You can create a blank query with the code below, the name of the query "YesterdayAsString".
let yesterday = Date.AddDays( DateTime.Date( DateTime.LocalNow() ), -1 ), year = Date.Year( yesterday ) * 10000, month = Date.Month( yesterday ) * 100, day = Date.Day( yesterday ), textDate = Text.From( year + month + day ) in textDateNext, adjust your m Expression to
= {Cube.ApplyParameter, "[!V000001]", { YesterdayAsString }}Best Regards,
Mariusz
If this post helps, then please consider Accepting it as the solution.
Please feel free to connect with me.
Mariusz
6 years agoCommunity Champion
Hi ivorhooper
You can create a blank query with the code below, the name of the query "YesterdayAsString".
let
yesterday =
Date.AddDays(
DateTime.Date(
DateTime.LocalNow() ), -1
),
year = Date.Year( yesterday ) * 10000,
month = Date.Month( yesterday ) * 100,
day = Date.Day( yesterday ),
textDate = Text.From( year + month + day )
in
textDate
Next, adjust your m Expression to
= {Cube.ApplyParameter, "[!V000001]", { YesterdayAsString }}
Best Regards,
Mariusz
If this post helps, then please consider Accepting it as the solution.
Please feel free to connect with me.

Mariusz
If this post helps, then please consider Accepting it as the solution.
Please feel free to connect with me.