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

Be one of the first to start using Fabric Databases. View on-demand sessions with database experts and the Microsoft product team to learn just how easy it is to get started. Watch now

Reply
Anonymous
Not applicable

Why am I getting a token In unexpected error? on the last line of my query in PowerQuery

 

 

 

let
    Source = Odbc.Query("driver={Amazon Redshift (x64)};server=awspbi-sam-adhoc.db.amazon.com;database=awspbi;port=8192;dsn=Amazon Redshift ODBC DSN"
,"

with LambdaTieredCustDesc As (
    select region, cust_desc, month_begin_date, primary_usage_type, SUM(usage_amount) as usage from ec2_bi.rpt_aws_monthly_est_revenue
        WHERE
    wbr_name        ='Lambda'
        and is_fraud_flag   = 'N'
        and is_internal_flag = 'N'
        AND cust_desc NOT LIKE '%[%]%'
        and primary_usage_type in  ('Lambda-GB-Second','Lambda-GB-Second-ARM')
        and month_begin_date = '2023-04-01' 
        group by region, cust_desc, month_begin_date, primary_usage_type having usage > 6000000000
)
select month_begin_date, cust_desc, region, primary_usage_type, sum(usage_amount) as usage
    from ec2_bi.rpt_aws_monthly_est_revenue
        where   wbr_name        ='Lambda'
        and is_fraud_flag   = 'N'
        and is_internal_flag = 'N'
        and primary_usage_type in  ('Lambda-GB-Second','Lambda-GB-Second-ARM','Request','Request-ARM')
        and month_begin_date >= '2023-04-01' 
        and cust_desc in (SELECT DISTINCT cust_desc from LambdaTieredCustDesc)
    group by 1,2,3,4,5
"),

 

 

Why am I getting a token In unexpected error? on the last line of my query in PowerQuery. I always get these similar errors and cannot resolve

1 REPLY 1
watkinnc
Super User
Super User

Remove the final comma and then type

 

in Source

 

--Nate


I’m usually answering from my phone, which means the results are visualized only in my mind. You’ll need to use my answer to know that it works—but it will work!!

Helpful resources

Announcements
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!

Dec Fabric Community Survey

We want your feedback!

Your insights matter. That’s why we created a quick survey to learn about your experience finding answers to technical questions.

ArunFabCon

Microsoft Fabric Community Conference 2025

Arun Ulag shares exciting details about the Microsoft Fabric Conference 2025, which will be held in Las Vegas, NV.

December 2024

A Year in Review - December 2024

Find out what content was popular in the Fabric community during 2024.

Top Solution Authors