Power BI is turning 10, and we’re marking the occasion with a special community challenge. Use your creativity to tell a story, uncover trends, or highlight something unexpected.
Get startedJoin us for an expert-led overview of the tools and concepts you'll need to become a Certified Power BI Data Analyst and pass exam PL-300. Register now.
Hello i have a question:
I created this query:
(Name as text,datetimestart as text, datetimeend as text, listzones as text, listaps as text, listdevices as text, listuserprops as text, topreg as text) as table =>
let
Source = Csv.Document(Web.Contents("https://localhost:44310/api/Emp?Name=" & Name & "&datetimestart=" & datetimestart & "&datetimeend=" & datetimeend & "&listzones=" & listzones & "&listaps=" & listaps & "&listdevices=" & listdevices & "&listuserprops=" & listuserprops & "&topreg=" & topreg & ""),[Delimiter=":", Encoding=65001, QuoteStyle=QuoteStyle.None])
in
Source
In total i have 8 parameters and i need to pass to the URL some empty parameters like "listdevices and listuserprops"
But when i try to do it i receive the message "Please specify a value for listuserprops"
Is there a way to pass a empty parameter and how ?
Thanks!!!
Solved! Go to Solution.
Hi @MarceloSilva5_ ,
Please try to update the codes of parameter listdevices and listuserprops as below and check if it can work or not:
null meta [IsParameterQuery=true, Type="Text", IsParameterQueryRequired=false]
And you can get the details of query parameter in the following links.
Creating Dynamic Parameters in Power Query
Best Regards
Hi @MarceloSilva5_ ,
Please try to update the codes of parameter listdevices and listuserprops as below and check if it can work or not:
null meta [IsParameterQuery=true, Type="Text", IsParameterQueryRequired=false]
And you can get the details of query parameter in the following links.
Creating Dynamic Parameters in Power Query
Best Regards
My Stored procedure :
if (@Name = 'UniqueVisits')
begin
set @BaseQuery = 'select count(distinct fp.device_id) as NVisits from f_presence fp '
if (@listzones is not null)
begin
--set @includeap = 1
set @QueryFilter = @QueryFilter + ' and coalesce(fp.zone_id,-1) in (' + @listzones + ')'
end
if (@listaps is not null)
set @QueryFilter = @QueryFilter + ' and coalesce(fp.ap_id,-1) in (' + @listaps + ')'
set @QueryFilter = ' WHERE ((fp.datetime_start < ' + cast(@datetimeend as nvarchar(12)) + ' and fp.datetime_end > ' + cast (@datetimestart as nvarchar(12)) + ') OR fp.datetime_start = ' + cast (@datetimestart as nvarchar(12)) + ')' + @QueryFilter
if (@includedevice = 1)
set @TablesJoin = @TablesJoin + ' inner join l_device ld on ld.device_id = fp.device_id '
--if (@includeap = 1)
--set @TablesJoin = @TablesJoin + ' inner join l_accesspoint lap on lap.ap_id = fp.ap_id '
if (@includesession = 1)
set @TablesJoin = @TablesJoin + ' inner join f_session fs on fs.presence_id = fp.presence_id and ((fs.datetime_start <'+ cast(@datetimeend as nvarchar(12)) + ' and fs.datetime_end > ' + cast (@datetimestart as nvarchar(12)) + ') OR fs.datetime_start = ' + cast (@datetimestart as nvarchar(12)) + ')'
if (@includeappsession = 1)
set @TablesJoin = @TablesJoin + ' inner join f_applicationsession fapps on fapps.session_id = fs.session_id and fapps.datetime_start < ' + cast(@datetimeend as nvarchar(12)) + ' and fapps.datetime_start >= ' + cast (@datetimestart as nvarchar(12))
if (@includeuserproperty = 1)
set @TablesJoin = @TablesJoin + ' inner join (' + @listuserprops + ') as lup on lup.aleuser_id = fs.user_id '
If I change to Dynamic Parameters . I always got this error i am not sure if is the power by or the API i never saw anything like that
Error:
My api :
public string getStudentDetails(string Name,Int64? Datetimestart, Int64? Datetimeend, string Listzones, string Listaps, string Listdevices, string Listuserprops, int? Topreg)
{
SqlConnection myConnection = new SqlConnection();
myConnection.ConnectionString = "Data Source=DESKTOP-R7QRMCV;Initial Catalog=DW_NSA;Integrated Security=True;TrustServerCertificate=true";
SqlCommand sqlCmd = new SqlCommand();
sqlCmd.CommandType = CommandType.StoredProcedure;
sqlCmd.CommandText = "GetMeasures2";
sqlCmd.Connection = myConnection;
sqlCmd.Parameters.AddWithValue("@Name", Name);
sqlCmd.Parameters.AddWithValue("@datetimestart", Datetimestart);
sqlCmd.Parameters.AddWithValue("@datetimeend", Datetimeend );
sqlCmd.Parameters.AddWithValue("@listzones", Listzones);
sqlCmd.Parameters.AddWithValue("@listaps", Listaps);
sqlCmd.Parameters.AddWithValue("@listdevices", Listdevices);
sqlCmd.Parameters.AddWithValue("@listuserprops", Listuserprops);
sqlCmd.Parameters.AddWithValue("@topreg", Topreg);
SqlDataAdapter sda = new SqlDataAdapter(sqlCmd);
DataSet ds = new DataSet();
string jsonString = string.Empty;
myConnection.Open();
sda.Fill(ds);
myConnection.Close();
if (ds.Tables.Count > 0 && ds.Tables[0].Rows.Count > 0)
{
jsonString = JsonConvert.SerializeObject(ds.Tables[0]);
}
return jsonString;
}
Pls use nullable in between
from
listdevices as text, listuserprops as text
to
listdevices as nullable text, listuserprops as nullable text
Thanks & Regards,
Mohammed Adnan
Learn Power BI: https://www.youtube.com/c/taik18
Doesn't Work 😪
This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.
Check out the June 2025 Power BI update to learn about new features.
User | Count |
---|---|
72 | |
68 | |
53 | |
39 | |
33 |
User | Count |
---|---|
70 | |
63 | |
57 | |
49 | |
46 |