简体   繁体   中英

DAX - Multiple tables & columns with measures in Power BI Import

I am writing a DAX query to be used while performing a Power BI SQL Server Analysis Services database Import. I want to limit the fields and records to be used. I cannot figure out how to include measures in my query. Any help would be appreciated!

This works:

EVALUATE (
SUMMARIZECOLUMNS (
'Date PT'[Calendar Date PT],
'Date PT'[Fiscal Month PT],
'Date PT'[Fiscal Year PT],
'Issue Code'[Code 2],
'Planning Cat'[Planning Area],
FILTER('Date PT', 'Date PT'[Fiscal Year PT]= "FY22"),
FILTER('Planning Cat', [Planning Area]= "NOA")
)
)

I need to add in Sales by Booked Date (a measure) and I get an error stating that this field "cannot be found or cannot be used in this expression"

THIS DOES NOT WORK

EVALUATE ( 
SUMMARIZECOLUMNS (
'Date PT'[Calendar Date PT],
'Date PT'[Fiscal Month PT],
'Date PT'[Fiscal Year PT],
'Issue Code'[Code 2], 
'Planning Cat'[Planning Area],
'Sales'[Sales by Booked Date],
FILTER('Date PT', 'Date PT'[Fiscal Year PT]= "FY22"), 
FILTER('Planning Cat', [Planning Area]= "NOA") 
) 
)

I have tried everything I can find but nothing seems to work. If I leave a measure out, it works as expected.

Try this way:

EVALUATE  
ADDCOLUMNS(
   SUMMARIZECOLUMNS (
      'Date PT'[Calendar Date PT], 
      'Date PT'[Fiscal Month PT], 
      'Date PT'[Fiscal Year PT], 
      'Issue Code'[Code 2], 
      'Planning Cat'[Planning Area], 
      FILTER(
         'Date PT', 
         'Date PT'[Fiscal Year PT]= "FY22"
      ), 
      FILTER(
         'Planning Cat', 
         [Planning Area]= "NOA"
      ) 
   ),
   "@SalesByBookedDate", CALCULATE ( 'Sales'[Sales by Booked Date] )
)

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM