Forum Discussion
Additional Measure to be defined
I have this below table for which, I need to determine the average value per Product category based on the country. I am able to get the values using the below measure . But I am getting stuck when I have to adjust the value on the Parameter P1 & P2.
Measure to get the initial value :-
P1 is 0.59 of the total value of P1 in Product Category B and P2 is 0.41 of the total value of P2 in Product Category B.
So Product Category B would be P1*0.59+P2*0.41.
One thing to remember, not alaways Parameter P1 & P2 would be present for Product Category B. If it is not there, then it should perform the above given measure.
Once you have derived the total value per Product category , then you have again re-adjust the value for the Parameter P1 & P2 for Product Category B only and all other value remains the same.
Any help will be highly appreciated.
| Year | Country | Product Category | Product Name | Sub - Category | Paramter | Value |
| 2021 | India | A | Iron | C1 | No | 0 |
| 2021 | India | A | Iron | C2 | No | 1 |
| 2021 | India | A | Iron | C3 | No | 1 |
| 2021 | India | A | Iron | C4 | No | 0 |
| 2021 | India | A | Iron | C5 | No | 1 |
| 2021 | India | A | Iron | C6 | No | 0 |
| 2021 | India | A | Iron | C7 | No | 0 |
| 2021 | India | A | Iron | C8 | No | 0 |
| 2021 | India | A | Iron | C9 | No | 0 |
| 2021 | India | A | Iron | C10 | No | 0 |
| 2021 | India | A | Iron | C11 | No | 1 |
| 2021 | India | A | Iron | C12 | No | 1 |
| 2021 | India | A | Aluminium | C1 | No | 0 |
| 2021 | India | A | Aluminium | C2 | No | 1 |
| 2021 | India | A | Aluminium | C3 | No | 1 |
| 2021 | India | A | Aluminium | C4 | No | 0 |
| 2021 | India | A | Aluminium | C5 | No | 0 |
| 2021 | India | A | Aluminium | C6 | No | 0 |
| 2021 | India | A | Aluminium | C7 | No | 0 |
| 2021 | India | A | Aluminium | C8 | No | 0 |
| 2021 | India | A | Aluminium | C9 | No | 1 |
| 2021 | India | A | Aluminium | C10 | No | 1 |
| 2021 | India | A | Aluminium | C11 | No | 1 |
| 2021 | India | A | Aluminium | C12 | No | 0 |
| 2021 | India | A | Steel | C1 | No | 1 |
| 2021 | India | A | Steel | C2 | No | 0 |
| 2021 | India | A | Steel | C3 | No | 1 |
| 2021 | India | A | Steel | C4 | No | 0 |
| 2021 | India | A | Steel | C5 | No | 1 |
| 2021 | India | A | Steel | C6 | No | 0 |
| 2021 | India | A | Steel | C7 | No | 0 |
| 2021 | India | A | Steel | C8 | No | 1 |
| 2021 | India | A | Steel | C9 | No | 1 |
| 2021 | India | A | Steel | C10 | No | 0 |
| 2021 | India | A | Steel | C11 | No | 1 |
| 2021 | India | A | Steel | C12 | No | 1 |
| 2021 | India | A | Copper | C1 | No | 0 |
| 2021 | India | A | Copper | C2 | No | 0 |
| 2021 | India | A | Copper | C3 | No | 0 |
| 2021 | India | A | Copper | C4 | No | 0 |
| 2021 | India | A | Copper | C5 | No | 0 |
| 2021 | India | A | Copper | C6 | No | 0 |
| 2021 | India | A | Copper | C7 | No | 1 |
| 2021 | India | A | Copper | C8 | No | 0 |
| 2021 | India | A | Copper | C9 | No | 0 |
| 2021 | India | A | Copper | C10 | No | 0 |
| 2021 | India | A | Copper | C11 | No | 0 |
| 2021 | India | A | Copper | C12 | No | 1 |
| 2021 | India | B | Wood | C1 | P1 | 1 |
| 2021 | India | B | Wood | C2 | P1 | 0 |
| 2021 | India | B | Wood | C3 | P1 | 1 |
| 2021 | India | B | Wood | C4 | P1 | 1 |
| 2021 | India | B | Wood | C5 | P1 | 1 |
| 2021 | India | B | Wood | C6 | P1 | 0 |
| 2021 | India | B | Wood | C7 | P1 | 0 |
| 2021 | India | B | Wood | C8 | P1 | 1 |
| 2021 | India | B | Wood | C9 | P1 | 0 |
| 2021 | India | B | Wood | C10 | P1 | 0 |
| 2021 | India | B | Wood | C11 | P1 | 0 |
| 2021 | India | B | Wood | C12 | P1 | 0 |
| 2021 | India | B | Cotton | C1 | P1 | 0 |
| 2021 | India | B | Cotton | C2 | P1 | 1 |
| 2021 | India | B | Cotton | C3 | P1 | 1 |
| 2021 | India | B | Cotton | C4 | P1 | 1 |
| 2021 | India | B | Cotton | C5 | P1 | 0 |
| 2021 | India | B | Cotton | C6 | P1 | 0 |
| 2021 | India | B | Cotton | C7 | P1 | 0 |
| 2021 | India | B | Cotton | C8 | P1 | 1 |
| 2021 | India | B | Cotton | C9 | P1 | 0 |
| 2021 | India | B | Cotton | C10 | P1 | 0 |
| 2021 | India | B | Cotton | C11 | P1 | 0 |
| 2021 | India | B | Cotton | C12 | P1 | 0 |
| 2021 | India | B | Glass | C1 | P2 | 0 |
| 2021 | India | B | Glass | C2 | P2 | 1 |
| 2021 | India | B | Glass | C3 | P2 | 1 |
| 2021 | India | B | Glass | C4 | P2 | 1 |
| 2021 | India | B | Glass | C5 | P2 | 0 |
| 2021 | India | B | Glass | C6 | P2 | 0 |
| 2021 | India | B | Glass | C7 | P2 | 0 |
| 2021 | India | B | Glass | C8 | P2 | 1 |
| 2021 | India | B | Glass | C9 | P2 | 0 |
| 2021 | India | B | Glass | C10 | P2 | 0 |
| 2021 | India | B | Glass | C11 | P2 | 0 |
| 2021 | India | B | Glass | C12 | P2 | 0 |
| 2021 | India | B | Plastic | C1 | P2 | 1 |
| 2021 | India | B | Plastic | C2 | P2 | 0 |
| 2021 | India | B | Plastic | C3 | P2 | 0 |
| 2021 | India | B | Plastic | C4 | P2 | 1 |
| 2021 | India | B | Plastic | C5 | P2 | 0 |
| 2021 | India | B | Plastic | C6 | P2 | 1 |
| 2021 | India | B | Plastic | C7 | P2 | 0 |
| 2021 | India | B | Plastic | C8 | P2 | 1 |
| 2021 | India | B | Plastic | C9 | P2 | 0 |
| 2021 | India | B | Plastic | C10 | P2 | 0 |
| 2021 | India | B | Plastic | C11 | P2 | 0 |
| 2021 | India | B | Plastic | C12 | P2 | 0 |
| 2021 | India | C | Bike | C1 | No | 1 |
| 2021 | India | C | Bike | C2 | No | 1 |
| 2021 | India | C | Bike | C3 | No | 1 |
| 2021 | India | C | Bike | C4 | No | 0 |
| 2021 | India | C | Bike | C5 | No | 0 |
| 2021 | India | C | Bike | C6 | No | 0 |
| 2021 | India | C | Bike | C7 | No | 0 |
| 2021 | India | C | Bike | C8 | No | 0 |
| 2021 | India | C | Bike | C9 | No | 0 |
| 2021 | India | C | Bike | C10 | No | 0 |
| 2021 | India | C | Bike | C11 | No | 1 |
| 2021 | India | C | Bike | C12 | No | 1 |
| 2021 | India | C | Car | C1 | No | 1 |
| 2021 | India | C | Car | C2 | No | 1 |
| 2021 | India | C | Car | C3 | No | 1 |
| 2021 | India | C | Car | C4 | No | 0 |
| 2021 | India | C | Car | C5 | No | 0 |
| 2021 | India | C | Car | C6 | No | 0 |
| 2021 | India | C | Car | C7 | No | 0 |
| 2021 | India | C | Car | C8 | No | 0 |
| 2021 | India | C | Car | C9 | No | 0 |
| 2021 | India | C | Car | C10 | No | 0 |
| 2021 | India | C | Car | C11 | No | 1 |
| 2021 | India | C | Car | C12 | No | 1 |
| 2021 | India | C | Cycle | C1 | No | 1 |
| 2021 | India | C | Cycle | C2 | No | 1 |
| 2021 | India | C | Cycle | C3 | No | 1 |
| 2021 | India | C | Cycle | C4 | No | 0 |
| 2021 | India | C | Cycle | C5 | No | 1 |
| 2021 | India | C | Cycle | C6 | No | 1 |
| 2021 | India | C | Cycle | C7 | No | 1 |
| 2021 | India | C | Cycle | C8 | No | 1 |
| 2021 | India | C | Cycle | C9 | No | 1 |
| 2021 | India | C | Cycle | C10 | No | 1 |
| 2021 | India | C | Cycle | C11 | No | 0 |
| 2021 | India | C | Cycle | C12 | No | 1 |
| 2021 | India | C | Cart | C1 | No | 1 |
| 2021 | India | C | Cart | C2 | No | 1 |
| 2021 | India | C | Cart | C3 | No | 1 |
| 2021 | India | C | Cart | C4 | No | 0 |
| 2021 | India | C | Cart | C5 | No | 1 |
| 2021 | India | C | Cart | C6 | No | 1 |
| 2021 | India | C | Cart | C7 | No | 1 |
| 2021 | India | C | Cart | C8 | No | 1 |
| 2021 | India | C | Cart | C9 | No | 1 |
| 2021 | India | C | Cart | C10 | No | 1 |
| 2021 | India | C | Cart | C11 | No | 0 |
| 2021 | India | C | Cart | C12 | No | 1 |
| 2021 | India | D | E1 | No | 4 | |
| 2021 | India | D | E2 | No | 3 | |
| 2021 | India | D | E3 | No | 2 |
7 Replies
- AnonymousNot applicable
Hi Diptarup ,
1. I used the following formula to calculate the average of each Category and Parameter
=CALCULATE(AVERAGE('Table'[Value]),ALLEXCEPT('Table','Table'[Product Category],'Table'[Paramter]))As the output shown, P1 in Product Category B =0.38 not 0.59 ; P2 in Product Category B =0.33 not 0.41
2. Since you want to calculate P1*0.59+P2*0.41 , it seems that Parameter column should be Int type not Text type,right?
Please provide me with more details about your table and your expected output or share me with your pbix file after removing sensitive data.
Best Regards,
Eyelyn Qin
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly. - DiptarupHelper II
Hi Eyelyn,
Many Thanks for taking time out for the query. You need to use the formula that I have used above to determine the value as this will be rolling average. This is output that will come
what I am expecting is as per the next condition , since I have P1 and P2 in fornt of B respectively, the rolling average should reflect
the table i would prefer would be
I am unable to attach the PBix . One thing to note since for country US the Parameters are not marked as P1 & P2 the Rolling Avarge and Revised Value would be same.
- smpa01Community Champion
- DiptarupHelper II
Kindly check my above post all the measures are now given there. Pasting below for you benefit.
MAX-Year = MAX('Table'[Year])Criteria = VAR categoryNumber = If('Table'[Sub - Category]="E1"||'Table'[Sub - Category]="E2"||'Table'[Sub - Category]="E3","-",VALUE(RIGHT('Table'[Sub - Category],LEN('Table'[Sub - Category])-1)))RETURNSWITCH(TRUE(),categoryNumber<=4, "C1",categoryNumber<=8, "C2",categoryNumber<=12,"C3",BLANK())Rolling Global Average = Var tble= SUMMARIZE(FILTER('Table','Table'[Year]='Table'[MAX-Year]),'Table'[Country],"AVG",SUMX(VALUES('Table'[Product Name]),AVERAGE('Table'[Value])))Return AVERAGEX(tble,[AVG])
- DiptarupHelper II
Additional Measures used:-
MAX-Year = MAX('Table'[Year])Criteria = VAR categoryNumber = If('Table'[Sub - Category]="E1"||'Table'[Sub - Category]="E2"||'Table'[Sub - Category]="E3","-",VALUE(RIGHT('Table'[Sub - Category],LEN('Table'[Sub - Category])-1)))RETURNSWITCH(TRUE(),categoryNumber<=4, "C1",categoryNumber<=8, "C2",categoryNumber<=12,"C3",BLANK())Rolling Global Average = Var tble= SUMMARIZE(FILTER('Table','Table'[Year]='Table'[MAX-Year]),'Table'[Country],"AVG",SUMX(VALUES('Table'[Product Name]),AVERAGE('Table'[Value])))Return AVERAGEX(tble,[AVG])Since US data is to heavy to load you can use India and change it to US and in parameter section make it No.
- DiptarupHelper II
Can somebody help on the below query raised. Would really appreciate any help on the query posted.