Quantcast
Channel: Desktop topics
Viewing all articles
Browse latest Browse all 216485

Allocating costs from one table to values in another table

$
0
0

I'm hoping someone can point me in the right direction, because I'm starting to think what I'm trying to do can't be done. Smiley Indifferent

 

Data Model:

Server Detail (InstanceID) 1-to-many to BillingDetail (InstanceID, ExtendedCost)

Standard Date table

 

I split ServerDetail into SingleServers and SharedServers based on certain criteria (there is no overlap between SingleServers and SharedServers, and every row from ServerDetail goes into one or the other).

 

So the data model really looks like this:

 

DM.PNG

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

I need to total up the costs, per month and department, of the SingleServers, and figure out the percentage of each for a given month:

 

Total Cost := CALCULATE(
	sum(BillingDetail[ExtendedCost]),
		 'SingleServers'
	)

%GT := DIVIDE(
		[Total Cost],
		CALCULATE(
			[Total Cost],
			ALL(SingleServers[Dept])
		)
	)

So for example I would get

 

TotCost.PNG

 

 

 

So far so good.  Now I need to compute the total cost for Shared Server per month:

Total Shared Cost := CALCULATE(
	sum(BillingDetail[ExtendedCost]),
		'SharedServers'
)

 


Shared.PNG

 

 

 

 

The final calculation I need to do (and hence, display) is the total cost of each single server (per month/dept) including that department's allocation (%GT) of the shared servers.  It seems like it should be a simple measure like

 

 Total With Alloc := [Total Cost] + ( [%GT] * [Total Shared Cost] )

 

But this is just showing me the value of [Total Cost]. I've tried wrapping it in CALCULATE, setting variables, everything I can think of - I can't seem to get the "Total Shared Cost" value available on the "SingleServer" side.

 

Am I even attempting something that is possible?

 

Thanks for any and all help

David Edelman


Viewing all articles
Browse latest Browse all 216485

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>