web
You’re offline. This is a read only version of the page.
close
Skip to main content

Notifications

Announcements

Community site session details

Community site session details

Session Id :
Finance | Project Operations, Human Resources, ...
Unanswered

Data entity for given SQL code

(0) ShareShare
ReportReport
Posted on by 123
Hello,
as This data enties will be used for power bi, I am not getting how to create data entity from this given SQL code
 
select 
     custtable.CUSTGROUP [sales type],
     salestable.SALESSTATUS [Order Status],
     convert(date,salestable.CREATEDDATETIME)  [Date],
     CASE WHEN (MONTH(salestable.CREATEDDATETIME)) <= 3 
                        THEN convert(varchar(4), YEAR(salestable.CREATEDDATETIME)-1) + '-' + convert(varchar(4), YEAR(salestable.CREATEDDATETIME)%100)    
                        ELSE convert(varchar(4),YEAR(salestable.CREATEDDATETIME))+ '-' + convert(varchar(4),(YEAR(salestable.CREATEDDATETIME)%100)+1)END AS Fiscal_Year,
     logisticsaddresscountryregiontranslation.LONGNAME [Country],
     salestable.INVENTSITEID                [Site/Location],
     salestable.INVENTLOCATIONID            [Warehouse],
     salestable.SALESID                        [Sales ID],
     salesline.LINEAMOUNT                    ,
     salesline.CURRENCYCODE                    [Currency],
     case when salesline.CURRENCYCODE = 'EUR' then salesline.LINEAMOUNT * 86 
          when salesline.CURRENCYCODE = 'INR' then salesline.LINEAMOUNT 
          when salesline.CURRENCYCODE = 'SGD' then salesline.LINEAMOUNT * 54
          when salesline.CURRENCYCODE = 'USD' then salesline.LINEAMOUNT * 72 end [Amount],
     dirpartytable.NAME                        [Customer],
     LOGISTICSPOSTALADDRESS.DISTRICTNAME [District]
     
from custtable custtable
left join SALESTABLE salestable on custtable.ACCOUNTNUM = salestable.CUSTACCOUNT 
left join DIRPARTYTABLE dirpartytable on custtable.PARTY = dirpartytable.RECID
left join SALESLINE salesline on salestable.SALESID = salesline.SALESID
--left join dirpartylocation dirpartylocation on custtable.PARTY = dirpartylocation.PARTY 
left join LOGISTICSPOSTALADDRESS logisticspostaladdress on salestable.DELIVERYPOSTALADDRESS = logisticspostaladdress.RECID
left join LOGISTICSADDRESSCOUNTRYREGIONTRANSLATION logisticsaddresscountryregiontranslation on logisticspostaladdress.COUNTRYREGIONID = logisticsaddresscountryregiontranslation.COUNTRYREGIONID
where 
SALESTABLE.DOCUMENTSTATUS in (3)
 
I have the same question (0)
  • Martin Dráb Profile Picture
    238,568 Most Valuable Professional on at
    Moved from D365 general forum to the Finance forum, because its seems to be about F&O and not about D365 in general. I also changed the topic from data Entity to Data entity for given SQL code, to make it a bit more concrete.
     
    I also suspect I've seen this question before - isn't it a duplicate?
     
    Do you have any particular problem that you want to discuss?
  • GirishS Profile Picture
    27,829 Moderator on at
    Hi M_R,
     
    I would suggest you create a normal data entity - List out all the tables and find out the relation between them.
    Based on that create a data entity - For conversions you can use Computed column or virtual field in Data entity.
    Refer to the below documentation for creating Computed column and virtual field.
    Also, you can add Data entity ranges.
     
    Thanks,
    Girish S.

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Congratulations to our 2025 Community Spotlights

Thanks to all of our 2025 Community Spotlight stars!

Leaderboard > Finance | Project Operations, Human Resources, AX, GP, SL

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 695 Super User 2026 Season 1

#2
Abhilash Warrier Profile Picture

Abhilash Warrier 360 Super User 2026 Season 1

#3
BillurSamdancioglu Profile Picture

BillurSamdancioglu 288 Most Valuable Professional

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans