I have created a parameter with 2 default values (YES NO) that the user can select only one of them. This parameter DOES NOT match any value in my dataset table. What I want to use this for is selecting only data records with On Hand balance records when they select the YES and select all records when they select NO. How do I use this parameter with in dataset query for 2 different tests for the On Hand either <> 0 or exclude the On Hand test al together? Image shows my parameter with the YES NO.
I need to use this parameter in my query, testing to see if they selected YES, then include the test for On Hand ,. 0. Else leave out this test. second image shows my query.
Thank you
Jim
Hi @jrubino77 - As you are looking to pass value to a SQL query based on a Slicer, then you first needs to bind the Slicer to a Power Query parameter. Also, it is possible only in Direct query and not in Import mode.
For information on this, refer to below Blog post
If want to create a Parameter in Power Query, then need to write two Source sql statements inside a single query and call the correct Source based on the Parameter value using IF statement. For this, can refer to below
I am not trying to pass value from a slicer. I want to use a value from the Parameter selected in my SQL where clause. I do not have a table column to compare to this value. Example table.yesnofield = @Parm_YesNo â I cannot do this. I want to do something like comparing the @Parm_YesNo = âYesâ then do more table column tests. OR if @Parm_YesNo = âNoâ then do these table column tests.
If you understand is this possible?
Thank you,
Jim
Hi @jrubino77 - Ignore my previous comment. I thought it is related to normal Power BI reports but now realized it is related to Paginated reports that I am not much aware of.
This works in SQL, donât see why it wouldnât in paginated report:
CASE
WHEN @OnHand = 'Yes'
THEN OnhandBalance
ELSE 1
END <> 0
If the user selects yes, the actual Onhand Balance column is brought back, and it will only those those where it is not 0. If yes isnât selected, the case statement will bring back 1, which is not 0, so will bring back all records.
Hi @jrubino77, we have just released Sue Bayesâ Paginated Report Writer course. Have you checked if this scenario has been discussed in one of the videos?
Yes I have gone through that course. I need more insight on how to use Parameters that I create within SQL. I am hoping her part 2 will show that.
Thank you,
Jim
While our users and experts do as much as reasonable to help you with your inquiries, not all concerns can be attended to especially if there are some learnings to be done. Thank you!