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
tanyatessteam
Frequent Visitor

Dax Filter/Parameters

I am trying to add parameters to a DAX query in Report Builder for Power Bi.  I am using my query from Power Bi Desktop by copying the query with performance analyzer.  I cannot get the filter/parameter to work and have tried multiple additions to the query any help is appreciated.

This is my query and I have tried adding 

FILTER(VALUES(Date'[MonthInCalendar]),PATHCONTAINS (@MonthYear,Date'[MonthInCalendar])) in the query.

 

// DAX Query
DEFINE
VAR __DS0Core =
SUMMARIZECOLUMNS(
'G_LEntries'[G_L_Account_No],
'G_LEntries'[G_L_Account_Name],
'Chart_of_Accounts'[Account_Category],
'Chart_of_Accounts'[AccountCategoryIndex],
'Chart_of_Accounts'[Account_Subcategory_Descript],
'Date'[MonthInCalendar],
'G_LEntries'[District],
"SumDebit_Amount", CALCULATE(SUM('G_LEntries'[Debit_Amount])),
"SumCredit_Amount", CALCULATE(SUM('G_LEntries'[Credit_Amount])),
"SumAmount", CALCULATE(SUM('G_LEntries'[Amount]))

)

VAR __DS0PrimaryWindowed =

__DS0Core

EVALUATE
__DS0PrimaryWindowed

ORDER BY
'G_LEntries'[G_L_Account_No],
'G_LEntries'[G_L_Account_Name],
'Chart_of_Accounts'[Account_Category],
'Chart_of_Accounts'[AccountCategoryIndex],
'Chart_of_Accounts'[Account_Subcategory_Descript],
'Date'[MonthInCalendar],
'G_LEntries'[District]

1 ACCEPTED SOLUTION

Well it was not very technical!  I added the date to the data source and didn't use my date table so that I could build the query and parameter in Power BI Report Builder instead of using the DAX query from Power Bi desktop.  

View solution in original post

4 REPLIES 4
tanyatessteam
Frequent Visitor

Unfortunately, these solutions did not work I just did it in another way.  Thanks for trying!

Tanya

Hi @tanyatessteam ,

 


 

I just did it in another way. 

 


Could you share us your method?

 

 

Best Regards,

Icey

Well it was not very technical!  I added the date to the data source and didn't use my date table so that I could build the query and parameter in Power BI Report Builder instead of using the DAX query from Power Bi desktop.  

Icey
Community Support
Community Support

Hi @tanyatessteam ,

 

How about this?

// DAX Query
DEFINE

VAR __DS0FilterTable = 
    FILTER(
      KEEPFILTERS(VALUES(Date'[MonthInCalendar])),
      PATHCONTAINS (@MonthYear,Date'[MonthInCalendar])))

VAR __DS0Core =
SUMMARIZECOLUMNS(
'G_LEntries'[G_L_Account_No],
'G_LEntries'[G_L_Account_Name],
'Chart_of_Accounts'[Account_Category],
'Chart_of_Accounts'[AccountCategoryIndex],
'Chart_of_Accounts'[Account_Subcategory_Descript],
'Date'[MonthInCalendar],
'G_LEntries'[District],
"SumDebit_Amount", CALCULATE(SUM('G_LEntries'[Debit_Amount])),
"SumCredit_Amount", CALCULATE(SUM('G_LEntries'[Credit_Amount])),
"SumAmount", CALCULATE(SUM('G_LEntries'[Amount]))
)

VAR __DS0PrimaryWindowed =
__DS0Core

EVALUATE

__DS0PrimaryWindowed

ORDER BY
'G_LEntries'[G_L_Account_No],
'G_LEntries'[G_L_Account_Name],
'Chart_of_Accounts'[Account_Category],
'Chart_of_Accounts'[AccountCategoryIndex],
'Chart_of_Accounts'[Account_Subcategory_Descript],
'Date'[MonthInCalendar],
'G_LEntries'[District]

 

 

Best Regards,

Icey

 

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

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.