cancel
Showing results for
Did you mean:

Earn a 50% discount on the DP-600 certification exam by completing the Fabric 30 Days to Learn It challenge.

Helper IV

## How to calculate weight of Rows based in conditions

I have the following requirement where i am supposed to calculate the weight of each row in a table.

I need to calculate the Weight column which is 100/ count ( KPI type and KPI)

For example in below KPIType focus area is having only 1 KPI(Operation) so it would be 100/1= 100%

Similarly , KPI type BL KPI is having 4 KPI (ST,CC,SC,Spares) hence it would be 100/4 = 25% each. for KPIGroup as Reliability

Note : KPIType would have duplicates also hence we need to consider KPIGroup also in calculation.

Can someone help to find a way where i can add a calculated column for below condition. Or is there any other way we can achieve this. Thanks in Advance.

 BL KPIGroup KPIType KPI Weight Gen Reliability Focus Area Operation 100% Gen Reliability BL KPI ST 25% Gen Reliability BL KPI CC 25% Gen Reliability BL KPI SC 25% Gen Reliability BL KPI Spares 25% Gen Financials BL Focus Area Substainability 100% Gen Financials BL KPI Controllable 33.33% Gen Financials BL KPI Margin 33.33% Gen Financials BL KPI Fuel 33.33% Gen Business BL Focus Area spend 100% Gen Financials BL KPI cost 50% Gen Financials BL KPI Strategy 50%
10 REPLIES 10
Solution Sage

Hi!
You should be able to use EARLIER() and a few filter conditions to make it work. Try this:

``````Weight =
DIVIDE(  //divide
100, //100 by..
CALCULATE(
count('Table'[KPIType]), //the number of KPI types...
FILTER(ALLSELECTED('Table'),
'Table'[KPIType] = EARLIER('Table'[KPIType]) && //...of current KPI type
'Table'[KPIGroup] = EARLIER('Table'[KPIGroup]) //That also belong to the current KPIGroup
)
)
)``````

Helper IV

I have similar requirement where i need to show weight based on KPI group..

But again KPI group will have KPIType, KPI,BI also into consideration.

So here the total number of KPI group / total count

 KPI Group Weight Reliability, Service Resilience & Security of Supply 20% Financial Efficiencies 20% Business Continuity 20% Sector/ Company Restructuring 20% Internal Control 20%

I tried the similar way which was suggested and it is not working.

Solution Sage

Hi,

I'm not sure I quite understand what you're looking for, could you help me expand your question?

Does the data table look the same as in the first example? But weight according to KPI group instead?

It would be great if you can have some example data and expected result as in the first case

Helper IV

So i will have two tables to display, the one which we saw earlier as below.

So here we need to create another table which is calculating average of individual KPI Type separately. Please see below as example.

 BL KPIGroup KPIType KPI Weight Var Gen Reliability Focus Area Operation 100% 0.1 Gen Reliability BL KPI ST 25% 0.11 Gen Reliability BL KPI CC 25% 0.12 Gen Reliability BL KPI SC 25% 0.13 Gen Reliability BL KPI Spares 25% 0.14 Gen Financials Focus Area Substainability 100% 0.15 Gen Financials BL KPI Controllable 33.33% 0.16 Gen Financials BL KPI Margin 33.33% 0.17 Gen Financials BL KPI Fuel 33.33% 0.18 Gen Business Focus Area spend 100% 0.1 Gen Financials BL KPI cost 50% 0.19 Gen Financials BL KPI Strategy 50% 0.2

Final Output table :

 KPIGroup Average Weight Reliability 0.3 33.33% Financials 0.525 33.33% Business 0.1 33.33%

sample Formula to calculate individual Avg of reliability.

Focus area Var (From first table)=sum(0.1) = 0.1

BL KPI Var = sum (BL KPI ( (0.11+0.12+0.13+0.14)) = 0.5

Average = Avg(0.1,0.5) = 0.3

 Reliability Avg Reliability Avg = AVERAGE( SUM (Var for Focus Area) (0.1), SUM( Var for BL KPI(ST,CC,SC,Spares)(0.11+0.12+0.13+0.14) Average(Sum(focus Area) + Sum(BL KPI ))

Let me know if this is clear. Thanks in advance. Please do help.

Solution Sage

Hi,
I'm still not entirely sure of what we're calculations. I don't really see how the numbers in the Average column in the Output table are averages.

But I made an attempt at recreating the Final Output table in the linked file. I hope it at least helps you coming closer to your solution. I created a new table for the output table, but it could probably be done just using measures in the original table as well, and let me know if you want me to try that road instead.

Helper IV

Please find below screenshot of two tables which are needed for output.

Keep in mind that there can be multiple KPIgroup , KPI , KPI type as mentioned in the initial table posted on the very first of this post. hope this helps.

Helper IV

This is sample calculation for Reliability.

Helper IV

I see you have taken two tables , table1 and table, But i have all the values in single table only.

In the earlier function  and other functions you have taken table and not table 1.

Solution Sage

Yeah, sorry that was a typo from my part. All should refer to the same table, the table you have your data in.

Helper IV

Thank you very much. It worked.