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

Get Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Learn more

Reply

I am unable to run Teradata SQL query in the Power BI Desktop

Hi,
I have a teradata SQL query which I am trying to include in my Power Bi connection. The query works fine in the Teradata SQL Assitance but when I am attempting to import data through Power Bi desktop connection. I see following error. 

virendrajadhav1_0-1702471210761.png


below is the SQL query I am working on.

select bat.* from (select 
"Processing Mode ", "Registration Number", "AUN", "Tracking Number", "Invoice Number",
"Invoice Item", "Invoice Date", "Sales Ord Number", "SO Line Item",
"Sold to Number","Sold to Name",
"Entering Branch", "Ship Date", "Part Number", "Neda Number", "Quantity Ordered", "Quantity Shipped",
"Unit Price", "Unit Cost",
"User ID", "GBC AUN", "SendingRegion", "SupplierAssignedSoldTo",
"OSShiptoCountry", "Country", "SupplierAssignedShipTo",
"OffshoreRegion", "OffshoreCurrency", "RcvRegionItem", "RcvRegionCorePart", "SendingRegionCorePart"
 
from (Select
       reg.registration_num
           AS "Registration Number",
       reg.tracking_num
           AS "Tracking Number",
       reg.internal_dwr_num
           AS "AUN",
       
       msi.segment3
           AS "Part Number",
       CASE
           WHEN reg.ssid = 5 THEN 'AC'
           WHEN reg.ssid = 9 THEN 'AP'
           WHEN reg.ssid = 2 THEN 'EU'
       END
           AS "SendingRegion",
       msi.DSWG_154_CORE_PART
           AS SendingRegionCorePart,
     CASE
           WHEN reg.ssid = 5 THEN 'ACGBC'
           WHEN reg.ssid = 9 THEN 'APGBC'
           WHEN reg.ssid = 2 THEN 'EUGBC'
       END
          as snd_gbc_region
   from ods_vw_gb_db_q.dsw_regstrations       reg,
       ods_vw_gb_db_q.dsw_boards             board,
       ods_vw_gb_db_q.dsw_projects           proj,
       ods_vw_gb_db_q.mtl_system_items       msi
    WHERE     board.dsw_boards_skey = reg.dsw_boards_skey
        AND proj.dsw_projects_skey = board.dsw_projects_skey
       -- AND reg.INTERNAL_DWR_NUM = '1032662'
--  and reg.attribute3 not like '%RCV%'
   AND reg.mtl_system_items_skey = msi.mtl_system_items_skey) snd,
   (select  CASE WHEN soli.unit_selling_price > 0 THEN 'ADD' ELSE 'SUB' END
           AS "Processing Mode",    ih.trx_number
           AS "Invoice Number",
       ili.line_number
           AS "Invoice Item",
       ih.trx_date
           AS "Invoice Date",
       soh.order_number
           AS "Sales Ord Number",
       soli.global_attribute1
           AS "SO Line Item",
       billto1.site_use_id
           AS "Sold to Number",
       billto1.account_name
           AS "Sold to Name",
       so.seb_name
           AS "Entering Branch",
       soli.IVH_SALES_DATE
           AS "Ship Date",
       '9999'
           AS "Neda Number",
       soli.ordered_quantity
           AS "Quantity Ordered",
       soli.shipped_quantity
           AS "Quantity Shipped",
       soli.unit_selling_price
           AS "Unit Price",
       soli.attribute3
           AS "Unit Cost",
       NULL
           AS "User ID",
       reg1.internal_dwr_id
           AS "GBC AUN",
       
       NULL
           AS SupplierAssignedSoldTo,
       NULL
           AS OSShiptoCountry,
       NULL
           AS Country,
       NULL
           AS SupplierAssignedShipTo,
       CASE
           WHEN reg1.ssid = 5 THEN 'AC'
           WHEN reg1.ssid = 9 THEN 'AP'
           WHEN reg1.ssid = 2 THEN 'EU'
       END
           AS OffshoreRegion,
      inv.attribute15
           AS OffshoreCurrency,
       msi1.segment3
           AS RcvRegionItem,
       msi1.DSWG_154_CORE_PART
           AS RcvRegionCorePart,
--   STRTOK(reg1.ATTRIBUTE3,'-',2) rcv_attribute3,
   reg1.ATTRIBUTE3 as rcv_attribute3,
   reg1.ssid as rcv_ssid
   from ods_vw_gb_db_q.dsw_inv_hist           inv,
       ods_vw_gb_db_q.dsw_regstrations       reg1,
       ods_vw_gb_db_q.INVOICE_LINE_ITEM      ili,
       ods_vw_gb_db_q.INVOICE_HEADER         ih,
       ods_vw_gb_db_q.sales_order_line_item  soli,
       ods_vw_gb_db_q.sales_order_header     soh,
       ods_vw_gb_db_q.customer_bill_to       billto1,
       ods_vw_gb_db_q.sales_organization     so,
       ods_vw_gb_db_q.mtl_system_items       msi1,
   ods_vw_ac_db_q.time_period_date tpd,
   ods_vw_ac_db_q.time_period_date tpd1
   where 1=1
   AND reg1.dsw_regstrations_skey = inv.dsw_regstrations_skey
       AND inv.invoice_line_item_skey = ili.invoice_line_item_skey
       AND IH.INVOICE_HEADER_SKEY = ILi.INVOICE_HEADER_SKEY
       AND SoH.SALES_ORDER_HEADER_SKEY = Soli.SALES_ORDER_HEADER_SKEY
       AND ili.sales_order_line_item_skey = soli.sales_order_line_item_skey
       AND soli.customer_bill_to_skey = billto1.customer_bill_to_skey
       AND soli.sales_entering_branch_skey = so.sales_entering_branch_skey
       AND reg1.mtl_system_items_skey = msi1.mtl_system_items_skey
  -- and reg1.attribute3 like '%1032662'
   and reg1.attribute3 not like '%RCV%'
   and ih.trx_date = tpd1.time_period_date
   and current_date = tpd.time_period_date
   and tpd1.relative_global_year = 0
/*    and tpd1.relative_global_month  >= 
  case when tpd.relative_global_month = 0 and tpd.fiscal_month_mmm = 'JAN' 
   then -2
   when tpd.relative_global_month = 0 and tpd.fiscal_month_mmm <> 'JAN' 
   then -12
   end*/
/*   
   and tpd1.relative_global_year  >= 
  case when tpd.relative_global_month = 0 and tpd.fiscal_month_mmm = 'JAN' 
   then -1
   when tpd.relative_global_month = 0 and tpd.fiscal_month_mmm <> 'JAN' 
   then 0
   end*/
   
) rcv
   where snd_gbc_region||'-'|| "AUN"  = rcv_attribute3) bat
   where not  exists (select 1 from ods_vw_gb_db_q.dsw_inv_hist hist
where bat."Invoice Number" = hist.os_inv_num
and bat."Invoice Item" = hist.os_inv_line_num
)
--and bat."GBC AUN" = 2014979

Thank you in advance



 

1 REPLY 1
lbendlin
Super User
Super User

looks like your Power BI user doesn't have permissions to access that view or that specific column in the view.

Helpful resources

Announcements
Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

October Power BI Update Carousel

Power BI Monthly Update - October 2025

Check out the October 2025 Power BI update to learn about new features.

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.