Unable to establish relationship for two fact tables with multiple many-to-many dimensions in Excel Data Model - excel

I have 3 tables (FACT1, FACT2, DIM1, DIM2)
FACT1:
Code Month Value
058 1 500
059 1 600
061 1 700
058 2 1000
059 2 1000
061 2 1000
FACT2:
Service Month Status Value
058-buy 1 OK 700
059-purchase 1 Missing 800
061-trade 1 OK 900
058-buy 2 OK 300
059-purchase 2 Missing 400
061-trade 2 OK 500
DIM1:
Code Service
058 058-buy
059 059-purchase
061 061-trade
DIM2:
Month Name
1 January
2 February
3 March
I have all 4 tables loaded into Data Model in Excel and created a new measure in FACT1
Value Total:=sum([Value])+sumx(FILTER('FACT2','FACT2'[Status]="OK"),'FACT2'[VALUE])
I have also created relationship between tables:
FACT1(Code) to DIM1(Code)
FACT2(Service) to DIM1(Service)
FACT1(Month) to DIM2(Month)
FACT2(Month) to DIM2(Month)
However, when I insert a new pivot using the data model by having
Code from DIM1 on "ROW"
Month from FACT1 on "COLUMN"
New Measure Value Total on "Values"
I get something like this:
Code 1 2 Grand Total
058 1500 2000 2500
059 600 1000 1600
061 2100 2400 3100
Grand Total 4200 5400 7200
Somehow it will get sliced by Month properly, but if you pay attention to the last column of the pivot table Grand Total, they are correct! 2500 is indeed 500 + 700 + 1000 + 300, 1600 is indeed 600 + 1000, 3100 is indeed 700 + 900 + 1000 + 500
The final grand total for the above 3 is correct at 7200 too.
Now the question is why the middle part of the pivot tables acts oddly?

For your Pivot Table, use Month from the DIM2 table, not the FACT1 table. With your current set-up, FACT1 cannot filter the FACT2 table, though DIM2 can.

Related

1) Issue In Normalize Transformation for Informatica Power Center

I am Trying to Normalize Records of My SOurce table using Normalize Transformation in informatica, But Sequence are not re-generating for different rows.
Below Is SOurce Table :
Store_Name Sales_Quarter1 Sales_Quarter2 Sales_Quarter3 Sales_Quarter4
DELHI 150 240 455 100
MUMBAI 100 500 350 340
Target Table :
Store_name
Sales
Quarter
I am Using Occurrence - 4, on Sales Column for getting GCID Sales.
For Quarter, I am Using GCID Sales column :
O/P :
STORE_NAME SALES_COLUMN QUARTER
Mumbai 100 1
Mumbai 500 2
Mumbai 350 3
Mumbai 340 4
Delhi 150 5
Delhi 240 6
Delhi 455 7
Delhi 100 8
Why Quarter Value is not restarting from 1 for Delhi and is continuing from 5 ?
There is a GK column that keeps sequential numbers for all rows. Definitely, GCID is the right column that keeps numbers per multi-occurrences in a row. So, double check that there is GCID port and not GK that is linked to QUARTER port to target…
It’s good to provide a screenshot for the mapping and for the normalizer transformation (Normalizer tab) to be more informative about your question/issue…
But I suppose you have 'Store_Name' port at level 1 and all 'Sales_Quarter1', 'Sales_Quarter2', 'Sales_Quarter3' and 'Sales_Quarter4' ports grouped at level 2 on Normalizer tab (using >> button at top left area). And at group level (for these four ports) you set the Occurrence to 4.

Best combined Values 2 columns excel

I have a table:
DEALS Frequency Total profit
1500 12 18000
500 20 10000
30000 5 60000
700 12 8400
I want a Formula to find the best frequency with the best total.
Output should be like:
12 18000
Frequency:
=INDEX(B2:B5,MATCH(MIN(ABS(B2:B5-AVERAGE(B2:B5))),ABS(B2:B5-AVERAGE(B2:B5)),0))
Total Profit:
=INDEX(C2:C5,MATCH(MIN(ABS(C2:C5-AVERAGE(C2:C5))),ABS(C2:C5-AVERAGE(C2:C5)),0))
Enter the formulas into cell and press CTRL + SHIFT + ENTER
Results:

SUMPRODUCT, CRITERIA and Blanks

I would like to multiply each fund monthly returns * monthly assets in the following snippet of data
FUND Jan_returns Feb_returns Jan_Assets Feb_Assets
1 -2 3 200 300
1 2 7 250 500
1 5 2 3000
2 6 5 500 600
2 8 900
2 9 1500 1500
3 -6 3 100 1000
3 -7 4 660 520
For example, FUND 1 Jan_returns * Jan_assets = 15100
The currently formula is:
=SUMPRODUCT(($B$1:$B$8)($B$1:$B$10=A2),($D$1:$D$8)($B$1:$B$8=A2))
Where A2 is a reference to the FUND.
This is working for January. However, When I do this for February I am getting #Value! for all 3 funds. I think it is because of the blanks and tried <>"" but just got strange numbers.
The results should be
FUND Jan Feb
1 15100 4400
2 16500 3000
3 -5220 5080
Any help in solving this problem is appreciated?
Like this, modify ranges as needed. Note that repeating the $B$1:$B$8=A2 is redundant* — you only need one instance.
=SUMPRODUCT(($A$2:$A$9=$G2)*B$2:B$9*D$2:D$9)
*I'm assuming the 10 in $B$1:$B$10=A2 is a typo and should be 8.

SUMIFS across multiple sheets

So I'm working on a workbook right now that is across 3 sheets, 'Data', 'RAW', 'Lookup'. On the Data tab it looks like, Sheet 1
A B C D E
Segment Ranking Amount Revenue Spend
Carbon 15 2 5000 550
Oxygen 30 3 6895 450
Minerals 45 1 4400 350
The Code I use for each column are as follows (Some of the Columns are named columns)
B =IF(NOT(ISERROR(SEARCH("OK",$A2))),SUMIFS(RAW!B:B,Output,"*"&INDEX(SegmentID,MATCH($A2,SegmentName,0))&"*"),SUMIFS(RAW!B:B,Output,"*"&INDEX(SegmentID,MATCH($A2,SegmentName,0))&"*",Output,"<>*OK*"))
C =IF(NOT(ISERROR(SEARCH("OK",$A2))),SUMIFS(RAW!C:C,Output,"*"&INDEX(SegmentID,MATCH($A2,SegmentName,0))&"*"),SUMIFS(RAW!C:C,Output,"*"&INDEX(SegmentID,MATCH($A2,SegmentName,0))&"*",SegmentName,"<>*OK*"))
D =IF(NOT(ISERROR(SEARCH("OK",$A2))),SUMIFS(RAW!D:D,Output,"*"&INDEX(SegmentID,MATCH($A2,SegmentName,0))&"*"),SUMIFS(RAW!D:D,Output,"*"&INDEX(SegmentID,MATCH($A2,SegmentName,0))&"*",Output,"<>""OK"))
E =IF(NOT(ISERROR(SEARCH("OK",$A2))),SUMIFS(Spend,Output,"*"&INDEX(SegmentID,MATCH($A2,SegmentName,0))&"*"),SUMIFS(Spend,Output,"*"&INDEX(SegmentID,MATCH($A2,SegmentName,0))&"*",Output,"<>*OK*"))
The RAW Sheet looks like (Sheet 2)
A B C D E
Output Ranking Amount Revenue Spend
Random_1234_Random 15 2 5000 550
Random_5678_Random 30 3 6895 450
Random_9102_Random 45 1 4400 350
Random_555_Random 60 4 4000 300
The Lookup Sheet Looks like (Sheet 3)
A B
Segment ID
Carbon 1234
Oxygen 5678
Minerals 9102
Carbon 555
The problem that I have right now is, it will only grab the first Carbon with ID 1234, and not grab the second Carbon with ID 555 at all resulting in:
A B C D E
Segment Ranking Amount Revenue Spend
Carbon 15 2 5000 550
The end result that I would like is for it to grab ALL Carbon with any ID and add all of them together as below into a single line. (RAW sheet, Random_1234_Random + Random_555_Random)
A B C D E
Segment Ranking Amount Revenue Spend
Carbon 75 6 9000 850
Any help would be great and if I need to provide more detail please let me know!
Thank you in advance,
Maykid

Excel How to make a formula differenciate different vehicle plates

I have little knowlage of excel and I'm trying to configure an excel table so I can get the consumption of gas for each vehicle in a company, but all the data is introduced in only one table, how can I calculate the increase of km's of each vehicle to then be able to calculate the consumption?
The problem is that I don't know how to make the formula differenciate for each different plate.
The table is the following:
**A B C D E F G**
**1** Date Plate km Gas Signed Increased km's Consum
**2** 1/1/2018 0157-AAA 123456 50 YES
**3** 5/1/2018 0157-AAA 123789 20 NO
**4** 8/2/2018 0157-AAA 123987 30 NO
**5** 1/2/2018 0582-BBB 123456 40 YES
**6** 1/3/2018 0356-CCC 123456 30 NO
Another exemple:
Data Plate km Gas Increased km Consum %
3/5/2017 1111-AAA 150 20 150 13,33333333
7/5/2017 1111-AAA 400 30 250 12
7/5/2017 2222-BBB 50 10 50 20
7/5/2017 3333-CCC 20 5 20 25
10/5/2017 2222-BBB 200 30 150 20
Each plate is a different vehicle
Gas is the amount of oil that the vehicle refills in L
The table is updated daily or every 2-3 days as it's manually filled
The problem is calculating the increased km's as they may be other plates in between in the same date.
Consum % = Gas/Increased km *100
I thought about just ordering the columns by date and by plate and apply a general formula to everything
Thanks
I think I finally "solved my problem", the formula with the one I work is based on a filter for the plates in order to get them ordered. then the formula is:
Increased km =IF(B2=B1;C2-C1;C2)

Resources