Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
niki_b
Helper I
Helper I

Parameters in Report Builder (DAX query from Power BI Report)

I am copying the dax query from PowerBI Performance analyser to create a report in Report Builder. The report works fine but I would like to add parameters just like slicers in PowerBI Report. I tried adding parameters manually but it does not work. Is there any way to make changes to my query.

I even tried this... 

 

 

 

 

TREATAS({@param}, 'table'[Column])

 

 

 

 

If anyone has any leads, it will be highly apppreciated.

I have tried the links to the articles posted in previous solutions. I was not able to figure it. 

Thanks a lot.

 

1 ACCEPTED SOLUTION
Icey
Community Support
Community Support

Hi @niki_b ,

 

I create a simple sample for adding parameters. Please check:

 

Sample data:

USE Test

CREATE TABLE Sales (
    Product VARCHAR(100),
	Store VARCHAR(100),
    Sales INT
)

INSERT INTO Sales VALUES('P1','S1',1)
INSERT INTO Sales VALUES('P2','S1',2)
INSERT INTO Sales VALUES('P3','S1',3)
INSERT INTO Sales VALUES('P1','S2',4)
INSERT INTO Sales VALUES('P4','S2',5)

 

Product Store Sales
P1 S1 1
P2 S1 2
P3 S1 3
P1 S2 4
P4 S2 5

 

para1.PNG

 

1. Create a data source.

 

2. Create a dataset needed.

 

3. Create Parameter tables for the fields needed.

Product.PNGStores.PNG

 

4. Create parameters.

ProductParameter.PNGProductParameter2.PNG

 

5. Modify Query of the dataset created in step2.

sales query.PNG

 

6. Test.

parameter.gif

 

 

 

Best Regards,

Icey

 

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

3 REPLIES 3
Icey
Community Support
Community Support

Hi @niki_b ,

 

I create a simple sample for adding parameters. Please check:

 

Sample data:

USE Test

CREATE TABLE Sales (
    Product VARCHAR(100),
	Store VARCHAR(100),
    Sales INT
)

INSERT INTO Sales VALUES('P1','S1',1)
INSERT INTO Sales VALUES('P2','S1',2)
INSERT INTO Sales VALUES('P3','S1',3)
INSERT INTO Sales VALUES('P1','S2',4)
INSERT INTO Sales VALUES('P4','S2',5)

 

Product Store Sales
P1 S1 1
P2 S1 2
P3 S1 3
P1 S2 4
P4 S2 5

 

para1.PNG

 

1. Create a data source.

 

2. Create a dataset needed.

 

3. Create Parameter tables for the fields needed.

Product.PNGStores.PNG

 

4. Create parameters.

ProductParameter.PNGProductParameter2.PNG

 

5. Modify Query of the dataset created in step2.

sales query.PNG

 

6. Test.

parameter.gif

 

 

 

Best Regards,

Icey

 

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

AbhiSSRS
Solution Sage
Solution Sage

You can add parameters in Report Builder Add Params section and use them in DAX too. Could you please post more details like the DAX you are trying to insert these in and where have you added these params.

 

AbhiSSRS_0-1625045969077.png

 

I already tried adding parameters from there. It gives me all the values for that parameter even after slicing.

 

niki_b_0-1625264891463.png

 

 

As you can see in the above image, I have selected Increment in my parameter, it is still returning me all the rows. It means it is not working.

 

My DAX is as follows. I copied it from performance analyzer in my PowerBI report.

 

// DAX Query
DEFINE

VAR __DS0FilterTable =
TREATAS({"1"}, 'ruleBankTypesHistory'[Change?])

VAR __DS0Core =
SELECTCOLUMNS(
KEEPFILTERS(
FILTER(
KEEPFILTERS(
SUMMARIZECOLUMNS(
'ruleBankTypesHistory'[Type],
'ruleBankTypesHistory'[Old Value],
'ruleBankTypesHistory'[New Value],
'ruleBankTypesHistory'[Field],
'users'[Updated By],
'ruleBankTypesHistory'[updatedAt],
'Rules'[Rule Name],
'ruleset'[Ruleset],
__DS0FilterTable,
"CountRowsruleBankTypesHistory", CALCULATE(COUNTROWS('ruleBankTypesHistory'))
)
),
OR(
OR(
OR(
OR(
OR(
OR(
OR(
NOT(ISBLANK('ruleBankTypesHistory'[Type])),
NOT(ISBLANK('ruleBankTypesHistory'[Old Value]))
),
NOT(ISBLANK('ruleBankTypesHistory'[New Value]))
),
NOT(ISBLANK('ruleBankTypesHistory'[Field]))
),
NOT(ISBLANK('users'[Updated By]))
),
NOT(ISBLANK('ruleBankTypesHistory'[updatedAt]))
),
NOT(ISBLANK('Rules'[Rule Name]))
),
NOT(ISBLANK('ruleset'[Ruleset]))
)
)
),
"'ruleBankTypesHistory'[Type]", 'ruleBankTypesHistory'[Type],
"'ruleBankTypesHistory'[Old Value]", 'ruleBankTypesHistory'[Old Value],
"'ruleBankTypesHistory'[New Value]", 'ruleBankTypesHistory'[New Value],
"'ruleBankTypesHistory'[Field]", 'ruleBankTypesHistory'[Field],
"'users'[Updated By]", 'users'[Updated By],
"'ruleBankTypesHistory'[updatedAt]", 'ruleBankTypesHistory'[updatedAt],
"'Rules'[Rule Name]", 'Rules'[Rule Name],
"'ruleset'[Ruleset]", 'ruleset'[Ruleset]
)

 

 

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.