Ledger balance by dimension query


I’m attempting to query a main account for balance within a specific dimension in 2012 (Main account “9999”, “Customer” dimension with value of “XXXX”)

I have the main account, I have the Attribute and AttributeValue, I do not have the insane development know how to write the 50 line select statement or query to get the balance. I investigated ten plus “jobs” I found and none seem to do what I need. Am I missing something, this seems like a common inquiry but I can’t find any decent examples.

Anyone have a example of this kind of lookup? or maybe just some advice, I’m stuck.

Thanks in advance,