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

Get certified in Microsoft Fabric—for free! For a limited time, get a free DP-600 exam voucher to use by the end of 2024. Register now

Reply
Syndicate_Admin
Administrator
Administrator

I want to send multiple values to a filter through a parameter in DAX

Hello Friends

I have this query in DAX that brings me a table with the expected values based on 3 fundamental filters

Compania = "American Plains Coop - Kansas"

For the months of = October, november , december

From the year 2022.

I show you the code of the query:

// DAX Query
DEFINE
VAR __DS0FilterTable =
TREATAS({"American Plains Coop - Kansas"}, 'company'[company_name])

VAR __DS0FilterTable2 =
FILTER(
KEEPFILTERS(VALUES('DDate'[year])),
AND('DDate'[year] IN {2022}, 'DDate'[year] IN {2022})
)

VAR __DS0FilterTable3 =
TREATAS({"November",
"October",
"December"}, 'DDate'[month])

VAR __DS0FilterTable4 =
TREATAS({"Agronomic"}, 'machine'[machine_type])

VAR __DS0Core =
SUMMARIZECOLUMNS(
ROLLUPADDISSUBTOTAL('machine'[last_machine_name], "IsGrandTotalRowTotal"),
__DS0FilterTable,
__DS0FilterTable2,
__DS0FilterTable3,
__DS0FilterTable4,
"mea_act_engine_hr_spray", 'metrics'[mea_act_engine_hr_spray]
)

VAR __DS0PrimaryWindowed =
TOPN(
502,
__DS0Core,
[IsGrandTotalRowTotal],
0,
[mea_act_engine_hr_spray],
0,
'machine'[last_machine_name],
1
)

EVALUATE
__DS0PrimaryWindowed

ORDER BY
[IsGrandTotalRowTotal] DESC,
[mea_act_engine_hr_spray] DESC,
'machine'[last_machine_name]

My problem is that for the anus variable

VAR __DS0FilterTable3 =
TREATAS({"November",
"October",
"December"}, 'DDate'[month])

It will always bring me the information of those particular months, and I want to know how it could be the code so that those values reach the query through a parameter that accepts multiple values called @month

So that, if I select Jan, Feb and March, bring me the info of those months ... or if I select only Jun and Jul the query adapts to those new values

Thank you in advance

1 REPLY 1
Syndicate_Admin
Administrator
Administrator

I was wrong... l variable with the problem is not "anus" is "month"

Helpful resources

Announcements
November Carousel

Fabric Community Update - November 2024

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

Live Sessions with Fabric DB

Be one of the first to start using Fabric Databases

Starting December 3, join live sessions with database experts and the Fabric product team to learn just how easy it is to get started.

Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount! Early Bird pricing ends December 9th.

Nov PBI Update Carousel

Power BI Monthly Update - November 2024

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