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

Help with an "IN" syntax for a DAX Query

Can someone please assist me with DAX syntax for this query where I want to use an "IN" statement? I have been struggling with this and looking up information online and I cannot figure it out.

 

This query works in DaxStudio:

 

EVALUATE
FILTER(
SUMMARIZECOLUMNS(
'_Oracle Payroll GL'[OPGL Emplyee Num],
'_Oracle Payroll GL'[OPGL Full Name],
FILTER('_Oracle Payroll GL','_Oracle Payroll GL'[OPGL Element Name]="Time Entry Wages"),
FILTER('Date Of Accounting','Date Of Accounting'[Acct Yr] =2020),
"Pay Hours",calculate(sum('_Oracle Payroll GL'[pay_hours])),
"Net Amount",calculate(sum('_Oracle Payroll GL'[db_amount]))),
[Net Amount]>0
)

 

 

***********

 

However, when I replace this line:

 

FILTER('Date Of Accounting','Date Of Accounting'[Acct Yr] =2020),

 

with this line:

 

FILTER('Date Of Accounting','Date Of Accounting'[Acct Yr] IN {2020,2019}),

 

I get an error but DaxStudio doesn't tell me what it is.

 

What do I need to do in order to get this to work?

1 ACCEPTED SOLUTION
CNENFRNL
Community Champion
Community Champion

there's a syntactic equivalence,

FILTER (
    'Date Of Accounting',
    'Date Of Accounting'[Acct Yr] = 2019
        || 'Date Of Accounting'[Acct Yr] = 2020
)

obviously more verbose.

Meanwhile, I couldn't tell any syntactic error in that IN {2019, 2020} expression.


Thanks to the great efforts by MS engineers to simplify syntax of DAX! Most beginners are SUCCESSFULLY MISLED to think that they could easily master DAX; but it turns out that the intricacy of the most frequently used RANKX() is still way beyond their comprehension!

DAX is simple, but NOT EASY!

View solution in original post

2 REPLIES 2
CNENFRNL
Community Champion
Community Champion

there's a syntactic equivalence,

FILTER (
    'Date Of Accounting',
    'Date Of Accounting'[Acct Yr] = 2019
        || 'Date Of Accounting'[Acct Yr] = 2020
)

obviously more verbose.

Meanwhile, I couldn't tell any syntactic error in that IN {2019, 2020} expression.


Thanks to the great efforts by MS engineers to simplify syntax of DAX! Most beginners are SUCCESSFULLY MISLED to think that they could easily master DAX; but it turns out that the intricacy of the most frequently used RANKX() is still way beyond their comprehension!

DAX is simple, but NOT EASY!

Anonymous
Not applicable

That worked! Thank you for your help. I will make a note of that for the future.

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.

Top Solution Authors