Solved

Related in Powerpivot - a one way street

Posted on 2015-01-01
12
112 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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
Revamp Your Training Process

Drastically shorten your training time with WalkMe's advanced online training solution that Guides your trainees to action.

 

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
 
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

SharePoint Admin?

Enable Your Employees To Focus On The Core With Intuitive Onscreen Guidance That is With You At The Moment of Need.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

A little background as to how I came to I design this code: Around 5 years ago I designed an add-in that formatted Excel files to a corporate standard, applying different cell colours and font type depending on whether the cells contained inputs,…
Some code to ensure data integrity when using macros within Excel. Also included code that helps secure your data within an Excel workbook.
Graphs within dashboards are meant to be dynamic, representing data from a period of time that will change each time the dashboard is updated with new data. Rather than update each graph to point to a different set within a static set of data, t…
This Micro Tutorial demonstrates in Microsoft Excel how to consolidate your marketing data by creating an interactive charts using form controls. This creates cool drop-downs for viewers of your chart to choose from.

705 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