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

Notifications

Announcements

No record found.

Community site session details

Community site session details

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

SQL Query to fetch Financial Dimension from LedgerAccount

(0) ShareShare
ReportReport
Posted on by 177

Hi Everyone, I got an requirement to develop monthly balance query for General ledger > Inquires and Reports > Voucher Transactions.  I am trying to fetch Financial Dimension Details from ledgeraccount in  GeneralJournalAccountEntry Table.

Example :        GeneralJournalAccountEntry.Ledger account - 10170100-30-251XX-9980--GLFA0016        

                       my SQL Query Field Financial Dimension  -  30-251XX-9980--GLFA0016    (my requirement is need to print like this excluding MainaccountId)

I can able to get the individual financial dimension details like costcenter, Department, etc from DefaultDimensionView (DefaultDimensionView.VALUECOMBINATIONRECID = GeneralJournalAccountEntry.LEDGERDIMENSION).  But, as per my requirement i need to show all the financial dimensions (if not there then ' ') in a single field. Please suggest how can i achieve this?

Thanks,

Prem

I have the same question (0)
  • HenryXie Profile Picture
    on at

    Hi Prem,

    hope below sql useful

    select gja.LEDGERDIMENSION,gja.LEDGERACCOUNT

    ,gja.RECID FROM GENERALJOURNALACCOUNTENTRY gja

    where gja.RECID = 5637144580

    declare @p_ledgerDimension as bigint;

    select @p_ledgerDimension = gja.LEDGERDIMENSION

    FROM GENERALJOURNALACCOUNTENTRY gja

    where gja.RECID = 5637144580

    select [1]+'-'+[2]+'-'+[3]+'-'+[4]+'-'+[5]

    from (

    select a.VALUEORDINAL, isnull(v.DISPLAYVALUE,'''''') as DISPLAYVALUE

    from (

    select 1 as VALUEORDINAL union all

    select 2 as VALUEORDINAL union all

    select 3 as VALUEORDINAL union all

    select 4 as VALUEORDINAL union all

    select 5 as VALUEORDINAL) as a

    left join DimensionAttributeLevelValueAllView as v

    on a.VALUEORDINAL = v.VALUEORDINAL and v.VALUECOMBINATIONRECID = @p_ledgerDimension

    ) as d

    pivot ( max(DISPLAYVALUE) for VALUEORDINAL in ([1],[2],[3],[4],[5])) piv

    ;

  • PK69 Profile Picture
    177 on at

    Hi Henry, the provided SQL Query still returning with LedgerAccount with MainaccountId.

    pastedimage1630553640498v1.png

    My requirement is i need to fetch Financial Dimension Without the MainAccountid

    As per the above screenshot i need to fetch as 20-101XX-2999--GLFA0001   instead of 10370300-20-101XX-2999--GLFA0001

  • HenryXie Profile Picture
    on at

    I think you can comment out the [1] 

    pastedimage1631090727096v1.png

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…

Neeraj Kumar – Community Spotlight

We are honored to recognize Neeraj Kumar as our Community Spotlight honoree for…

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

#1
Martin Dráb Profile Picture

Martin Dráb 660 Most Valuable Professional

#2
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 549 Super User 2025 Season 2

#3
Sohaib Cheema Profile Picture

Sohaib Cheema 307 User Group Leader

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans