last day (25 days later) » 

12:39
0
A: How to setup a stored procedure with incremental dates in Power BI

Umut KYou can do it at the Power Query side... First create the parameters of dBaseIP and dBase in case you may need to change it later... Then create a custom function which will run the SQL query "New Query" → Other Sources → "Blank Query". let Source = (Query as text) => let Source = Sql...

So i have create the both in Power Query right ??
@Moeez yes and also two parameters in case you need to change the server and database later...
ok but first I have to load the database right ??
Kindly check my update I have tried your solution
@Moeez did you add these queries with "New Query" -> Other Sources --> "Blank Query" ?
@Moeez these are not SQL queries, these are power queires...
Yes I did also add tried to add these queries in Blank Query but it doesn't gives me any result :(
12:39
@Moeez i added a sample file... please check...
I have opened your file but didn't find any helpful material the query that you have mentioned execute ED_DS_TRANS_DETAIL01 @DateFrom ='2022-09-25', @DateTo = '2022-09-26' is already used by me. So what is the difference?
@Moeez when you open the file tomorrow, it will give you execute ED_DS_TRANS_DETAIL01 @DateFrom ='2022-09-26', @DateTo = '2022-09-27' everyday it will change according to the Today's date
how did you set it ?
tdy = Date.From(DateTime.LocalNow()), yest = Date.AddDays(tdy , - 1),
@Moeez if you change the server IP and database name in my sample file, it should work fine if you have the right credentials...
That's what I am asking from where in your file I can change the credentials ?
12:39
open Power Query and find the Data Source Settings icon , there you can set the credentials and also on the Parameter side , you can set your servername and database name
ok let me check it
12:53
I am confused in where to add let
Source = (Query as text) => let
Source = Sql.Database(dBaseIP, dBase , [Query=Query, CreateNavigationProperties=false])
in
Source
in
Source
and let
tdy = Date.From(DateTime.LocalNow()),
yest = Date.AddDays(tdy , - 1),
sQuery = Table.FromRecords({
[sQuery = "execute ED_DS_TRANS_DETAIL01 @DateFrom ='" & Date.ToText(yest,[Format="yyyy-MM-dd"]) & "', @DateTo = '" & Date.ToText(tdy,[Format="yyyy-MM-dd"]) & "'"
]}),
#"Invoked Custom Function" = Table.AddColumn(sQuery, "Query2", each #"Fnc Query"([sQuery]))
in
#"Invoked Custom Function"
dont touch to Custom Function
check the parameters sections
to set up your database name and IP
and also check the icon Data Source Settings
i have to leave now... check the picture i sent... you will find your settings in these...

  last day (25 days later) »