Solved

Related in Powerpivot - a one way street

Posted on 2015-01-01
12
95 Views
Last Modified: 2015-01-05
hi Folks
I've got 3 tables - let's call them Table1, Table 2 and Table 3 (all connected many to one) to a Chart of accounts table. Relationships all set up and working. I now want to use Related to pull a value from Table 1 into my chart of accounts. I get an error message. When I try Related in the other direction i.e. pull in something from Chart of Accounts into Table 1 - it works fine...any suggestions/workarounds? Thanks.
0
Comment
Question by:agwalsh
  • 6
  • 6
12 Comments
 
LVL 24

Expert Comment

by:Phillip Burton
ID: 40526621
If RELATED works in one direction, then you probably need RELATEDTABLE in the other, as you are probably going from the one to the many direction, instead of the other way round.

See http://msdn.microsoft.com/en-us/library/ee634226.aspx for examples and the syntax.
0
 

Author Comment

by:agwalsh
ID: 40526655
hm, OK, this is what I have and I'm still getting an error message:
=if(and([Reclassification]="Reversible",RELATEDTABLE('SH_TB_Oct-14',[Sum of  Nov 2014 PTD actuals])<0),"Current Liabilities",[Account])

What I want to happen is that if the phrase "reversible" is in the Reclassification column AND the value of [Sum of  Nov 2014 PTD actuals] in the 'SH_TB_Oct-14 table is negative, THEN I want to see "Current Liabilities", otherwise whatever is in the account field..
I suspect I'm getting the RelatedTable syntax wrong....
0
 
LVL 24

Expert Comment

by:Phillip Burton
ID: 40526895
RELATEDTABLE returns a table, but your expression can only deal with a single value.

Therefore, you need a SUMX() or other aggregate function around it.
0
 

Author Comment

by:agwalsh
ID: 40527357
OK, so what would you suggest for the formula above? I want the formula to switch the categorisation of a transaction from asset to liability assuming it's "reversible" and a minus value...thanks :-)
0
 
LVL 24

Accepted Solution

by:
Phillip Burton earned 500 total points
ID: 40527367
I am not familiar enough with your fields and relationships to be able to help at present.

Have a think about what the fields are that you need, and the relationships between them (e.g. one-to-many).

Here's a possible solution:

=if(and([Reclassification]="Reversible",SUMX(RELATEDTABLE('SH_TB_Oct-14',[Sum of  Nov 2014 PTD actuals]))<0),"Current Liabilities",[Account])

However, you may need to convert Account to a string, because you are outputting both a string and a number, depending on the result. Try changing "Current Liabilities" to -1 and see if you can get it to work first, then try re-inserting the string.

So try

=if(and([Reclassification]="Reversible",SUMX(RELATEDTABLE('SH_TB_Oct-14',[Sum of  Nov 2014 PTD actuals]))<0),-1,[Account])
0
 

Author Comment

by:agwalsh
ID: 40531471
@Phillip Burton...reader, I got it working :-)
You were right about the string thing.  This is what worked..I think you were missing a bracket after the RELATEDTABLE function....:-)
=if(and([Reclassification]="Reversible",sumx(RELATEDTABLE('SA_TB_Oct-14'),[SAA_Nov_14_YTD_Act])<0),1,23456)
so I just put in numbers instead. It wouldn't work with [account] or "current liability" but it would work with numbers.
I tried reinserting the string - but it didn't like that either. So do I now need to put in another column that says if this is a -1 enter current liability, otherwise enter whatever is there...presume that would be a straightforward if statement? Thank you so much for this by the way :-)
0
Enabling OSINT in Activity Based Intelligence

Activity based intelligence (ABI) requires access to all available sources of data. Recorded Future allows analysts to observe structured data on the open, deep, and dark web.

 
LVL 24

Expert Comment

by:Phillip Burton
ID: 40531473
You're welcome - and yes.

Bear in mind that SUMX is a sum product, so you have to decide what to do if there are multiple entries.

Do you want the maximum entry, or does one negative value and several positive values stop the lot from working - or what?

It may be that you will only have a 1-to-1 relationship, but because the relationship is set up for a one-to-multiple, it is expected more than one row. So, what do you want to do if there are multiple values?
0
 

Author Closing Comment

by:agwalsh
ID: 40531487
This was driving me nuts but Phillip's elegant solution sorted it for me. Very happy with it :-)
0
 

Author Comment

by:agwalsh
ID: 40531511
Well, it's a one to many relationship from TB to Chart of Accounts.  What I want it to do is that if a value meets those two conditions i.e. marked as reversible and is a liability in the TB table i.e. minus, that what appears in the calculated column is "Current liability". The idea is that there are balances which swing from current asset to current liability depending on the balance e.g. certain types of taxes. These are marked as reversible in the chart of accounts and I want this reflected in the balance sheet.
0
 
LVL 24

Expert Comment

by:Phillip Burton
ID: 40531515
0
 

Author Comment

by:agwalsh
ID: 40531600
Hi Phillip
Of course I saw that as minx first i.e. "an impudent, cunning, or boldly flirtatious girl or young woman". LOL
But I presume you mean MinX :-) so you think I should use that instead of SumX in the formula? Thanx :-)
0
 
LVL 24

Expert Comment

by:Phillip Burton
ID: 40531605
If you want one negative value to outweight all the positive ones, then yes.
0

Featured Post

Threat Intelligence Starter Resources

Integrating threat intelligence can be challenging, and not all companies are ready. These resources can help you build awareness and prepare for defense.

Join & Write a Comment

Improved? Move/Copy Add-in Replacement - How to avoid the annoying, “A formula or sheet you want to move or copy contains the name XXX, which already exists on the destination worksheet.” David Miller (dlmille)  It was one of those days… I wa…
This article descibes how to create a connection between Excel and SAP and how to move data from Excel to SAP or the other way around.
This Micro Tutorial demonstrate the bugs in Microsoft Excel for Mac with Pivot Charts.
This Micro Tutorial will demonstrate how to use longer labels with horizontal bar charts instead of the vertical column chart.

708 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now