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

Find everything you need to get certified on Fabric—skills challenges, live sessions, exam prep, role guidance, and more. Get started

Reply
Anonymous
Not applicable

How to use "IN" operator in power Query

Hi All,

 

Am new to Power BI and MSQL

I have a power query to import data from Microsoft Services where in i am currently using "OR" operator (Max 2) data values under a column to be checked while importing.

But my query should import data from service when this column is checked more than 2 values like FY 2015, FY 2016--- FY 2019.

 

Current PQuery:

 

EVALUATE
CALCULATETABLE (
ADDCOLUMNS (
"NPS Passive Count", 'NPS'[NPS Passive Count],
"NPS Advocate Count", 'NPS'[NPS Advocate Count],
"NPS Detractor Count", 'NPS'[NPS Detractor Count]
)
,OR ('Survey Response Date'[Financial Year] = "FY 2018" ,'Survey Response Date'[Financial Year] = "FY 2019")

)

 

Could you please help me with this at the earliest?

 

Thanks:

Nishanth

1 ACCEPTED SOLUTION
d_gosbell
Super User
Super User

This is not Power Query, it's a DAX query. "Power Query" (also known by it's codename of "M") is the term given to the language used by the queries when you click on the "Get Data" button in Power BI.

 

To use the IN operator in DAX you would do the following:

 

EVALUATE
CALCULATETABLE (
ADDCOLUMNS (
"NPS Passive Count", 'NPS'[NPS Passive Count],
"NPS Advocate Count", 'NPS'[NPS Advocate Count],
"NPS Detractor Count", 'NPS'[NPS Detractor Count]
)
,'Survey Response Date'[Financial Year] IN { "FY 2018", "FY 2019"} )

)

View solution in original post

2 REPLIES 2
Anonymous
Not applicable

Hi nmaheshwarappa,

 

You can multiple ORs in your logical condition.

 

Like,

 

OR('Survey Response Date'[Financial Year] = "FY 2016",(OR('Survey Response Date'[Financial Year] = "FY 2017",OR ('Survey Response Date'[Financial Year] = "FY 2018" ,'Survey Response Date'[Financial Year] = "FY 2019"))))

 

Regards,

Pradeep

d_gosbell
Super User
Super User

This is not Power Query, it's a DAX query. "Power Query" (also known by it's codename of "M") is the term given to the language used by the queries when you click on the "Get Data" button in Power BI.

 

To use the IN operator in DAX you would do the following:

 

EVALUATE
CALCULATETABLE (
ADDCOLUMNS (
"NPS Passive Count", 'NPS'[NPS Passive Count],
"NPS Advocate Count", 'NPS'[NPS Advocate Count],
"NPS Detractor Count", 'NPS'[NPS Detractor Count]
)
,'Survey Response Date'[Financial Year] IN { "FY 2018", "FY 2019"} )

)

Helpful resources

Announcements
Sept PBI Carousel

Power BI Monthly Update - September 2024

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

September Hackathon Carousel

Microsoft Fabric & AI Learning Hackathon

Learn from experts, get hands-on experience, and win awesome prizes.

Sept NL Carousel

Fabric Community Update - September 2024

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