Don't miss your chance to take the Fabric Data Engineer (DP-700) exam on us!
Learn moreNext up in the FabCon + SQLCon recap series: The roadmap for Microsoft SQL and Maximizing Developer experiences in Fabric. All sessions are available on-demand after the live show. Register now
Does anyone know how I can embed the following formula 100(sum(KPI1)/sum(KPI1_COUNT))* as a new column. With the sum being based on each unique "Applicant_Company" and "Work_Area" and each month (See below)
Solved! Go to Solution.
Hi @Anonymous ,
According to my understanding , you want to calculate SUM(KPI1)/SUM(KPI1_COUNT) based on three categories,right?
You could use EARLIER() or ALLEXCEPT() function shown below:
Column =
CALCULATE (
SUM ( 'Table'[KPI1] ) / SUM ( 'Table'[KPI1_COUNT] ),
FILTER (
'Table',
'Table'[Applicant_Company] = EARLIER ( 'Table'[Applicant_Company] )
&& 'Table'[Work_Area] = EARLIER ( 'Table'[Work_Area] )
&& 'Table'[Date].[MonthNo] = EARLIER ( 'Table'[Date].[MonthNo] )
)
)Column 2 =
CALCULATE (
SUM ( 'Table'[KPI1] ) / SUM ( 'Table'[KPI1_COUNT] ),
ALLEXCEPT (
'Table',
'Table'[Applicant_Company],
'Table'[Work_Area],
'Table'[Date].[MonthNo]
)
)Here is the final output :
Please take a look at the pbix file here.
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.
Hi @Anonymous ,
According to my understanding , you want to calculate SUM(KPI1)/SUM(KPI1_COUNT) based on three categories,right?
You could use EARLIER() or ALLEXCEPT() function shown below:
Column =
CALCULATE (
SUM ( 'Table'[KPI1] ) / SUM ( 'Table'[KPI1_COUNT] ),
FILTER (
'Table',
'Table'[Applicant_Company] = EARLIER ( 'Table'[Applicant_Company] )
&& 'Table'[Work_Area] = EARLIER ( 'Table'[Work_Area] )
&& 'Table'[Date].[MonthNo] = EARLIER ( 'Table'[Date].[MonthNo] )
)
)Column 2 =
CALCULATE (
SUM ( 'Table'[KPI1] ) / SUM ( 'Table'[KPI1_COUNT] ),
ALLEXCEPT (
'Table',
'Table'[Applicant_Company],
'Table'[Work_Area],
'Table'[Date].[MonthNo]
)
)Here is the final output :
Please take a look at the pbix file here.
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.
Hi thats great thanks! can I ask, if both the KPI1 and KPI_COUNT columns are 0, do you know how within the formula I can put a IF clause which will make the calculation revert to 100?
Hi @Anonymous ,
The DIVIDE() function was designed to automatically handle division by zero cases.
See the differences between DIVIDE() and / here.
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.
Not sure I follow exacly, maybe you could knock up a mock table to show what you currently have and what the expected result would be with the additional column?
If you have recently started exploring Fabric, we'd love to hear how it's going. Your feedback can help with product improvements.
A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.
Share feedback directly with Fabric product managers, participate in targeted research studies and influence the Fabric roadmap.
| User | Count |
|---|---|
| 48 | |
| 44 | |
| 42 | |
| 18 | |
| 18 |
| User | Count |
|---|---|
| 72 | |
| 66 | |
| 33 | |
| 32 | |
| 31 |