Best combined Values 2 columns excel - 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:

Related

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

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.

I have a table with column AGE with numbers. I wanted to cluster similar number and count

AGE
CARD
SCORE
10
1
20000
10
1
3000
25
0
2000
10
1
20000
18
1
3000
10
0
2000
12
1
20000
10
1
3000
10
0
2000
I want to count Age 10 as 4.
The first two rows (group) should be counted as 1 and 10 appearing in different rows can be added individually and the last two rows (group of age 10) should be counted as 1.
Assuming that data is in a table named "Table1":
=COUNT(1/FREQUENCY(IF(Table1[AGE]=10,ROW(Table1[AGE])),IF(Table1[AGE]<>10,ROW(Table1[AGE]))))

Group by two columns and count and then compare

I have data in Excel that looks like this:
ID DATE COST TOTAL
1 01-01-18 50 100
1 01-01-18 25 100
1 01-01-18 25 100
2 01-03-18 25 100
2 01-03-18 25 100
2 01-03-18 50 100
1 02-01-18 100 100
I want to group by ID and Date then count the cost and ensure it quals to the total for that ID and date. So for example ID 1 and date 01-01-18 I want to count the 50 and 25 and 25 and compare it to 100 to return a true or false.
How can I do this?
SUMIFS will do what you want. Assuming your example data starts at A1, add a 5th column with this formula in cell E2:
=SUMIFS($C$2:$C$7,$A$2:$A$7,A2,$B$2:$B$7,B2)=D2
Then fill it down to cell E7.

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)

Excel - running % of running total in pivot table

I have a table like:
periodo quintil pos
201611 1 10
201611 2 20
201611 3 30
201611 4 40
201611 5 50
201612 1 9
201612 2 19
201612 3 29
201612 4 39
201612 5 49
I need to create a pivot table like:
periodo quintil running_pos running_%
201611
1 10 7%
2 30 20%
3 60 40%
4 100 67%
5 150 100%
201612
1 9 6%
2 28 19%
3 57 39%
4 96 66%
5 145 100%
Since the running total is not a new field, but a way to show an older field (pos- show as total in quintil), the problem arises when I try to create the running % of the running total.
How can I introduce also this field (running % of running total)?
In spanish there's nothing with a name like running totals translation....
To display what you want in a Pivot Table
- Drag pos to the values area three times
- For the first, use the SUM
- For the second, use the "show as running total"
- For the third, use the "show as % running total"
Here are the results with minimal formatting
Here are the value settings for the third column:

Resources