Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
?
Solved

Related in Powerpivot - a one way street

Posted on 2015-01-01
12
Medium Priority
?
132 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
Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

 

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

Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

Question has a verified solution.

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

This article describes how to use a set of graphical playing cards to create a Draw Poker game in Excel or VB6.
If you need to forecast numbers -- typically for finance -- the Windows and Mac versions of Excel 2016 have a basket of tools to get the job done.
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…
Finds all prime numbers in a range requested and places them in a public primes() array. I've demostrated a template size of 30 (2 * 3 * 5) but larger templates can be built such 210  (2 * 3 * 5 * 7) or 2310  (2 * 3 * 5 * 7 * 11). The larger templa…

564 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