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
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
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.