The ultimate Fabric, Power BI, SQL, and AI community-led learning event. Save €200 with code FABCOMM.
Get registeredCompete to become Power BI Data Viz World Champion! First round ends August 18th. Get started.
Hello,
I have two problems 😞
FIRST I need to compare 'sum of all ID email per employee' with 'all team average'
Table[Data]
employee | DATE | id EMAIL |
X | 20.02.2024 | 123456 |
Y | 20.02.2024 | 123456 |
Z | 20.02.2024 | 123456 |
Z | 20.02.2024 | 123456 |
Z | 20.02.2024 | 123456 |
Z | 20.02.2024 | 123457 |
Z | 20.02.2024 | 123458 |
Z | 20.02.2024 | 123459 |
X | 20.02.2024 | 123459 |
X | 20.02.2024 | 123459 |
Y | 20.02.2024 | 123459 |
X | 20.02.2024 | 112345 |
X | 20.02.2024 | 112549 |
Y | 20.02.2024 | 123584 |
Z | 20.02.2024 | 123695 |
example :
sum of e-mail = 15
amount of employess =3 (X,Y,Z)
ave. email = 15/3=5
x -> 5 emails
y-> 3 emails
z -> 7 emails
employee participation X =5/5 = 100% , Y= 3/5 = 60%, Z=7/5= 140%
Output
EMPLOYEE | lp | % |
X | 5 | 100% |
Y | 3 | 60% |
Z | 7 | 140% |
AVERAGE | 5 | 100% |
SECOND : I would like the summed average value to be provided in the pivot table for the average calculated in the query above, but only for non-empty records ( I don't want emty records to lower the average )
My output : AVERAGE COUNT WITHOUT non empty records ( below )
X | Y | Z | AVERAGE | X | Y | Z | |
01.01.2024 | 4 | 9 | 5 | 6 | 67% | 150% | 83% |
02.01.2024 | 5 | 5 | 6 | 5 | 94% | 94% | 113% |
03.01.2024 | 6 | 8 | 2 | 5 | 113% | 150% | 38% |
04.01.2024 | 2 | 2 | 5 | 3 | 67% | 67% | 167% |
05.01.2024 | 5 | 5 | 8 | 6 | 83% | 83% | 133% |
06.01.2024 | 8 | 3 | 6 | 145% | 0% | 55% | |
07.01.2024 | 3 | 9 | 6 | 0% | 50% | 150% | |
08.01.2024 | 6 | 6 | 6 | 100% | 0% | 100% | |
09.01.2024 | 5 | 2 | 2 | 3 | 167% | 67% | 67% |
10.01.2024 | 4 | 4 | 4 | 100% | 100% | 0% | |
11.01.2024 | 2 | 6 | 4 | 50% | 150% | 0% | |
12.01.2024 | 6 | 9 | 8 | 80% | 120% | 0% | |
AVERAGE WITH ALL RECORDS | 89% | 86% | 75% | ||||
AVERAGE COUNT WITHOUT non empty records | 97% | 103% | 101% |
Solved! Go to Solution.
Hi @MartaBak ,
Depending on the information you have provided, you can follow these steps below:
1.Add an index column.
2.Add two columns.
IP =
VAR _1 =
CALCULATE (
MIN ( 'Table'[Index] ),
FILTER ( 'Table', 'Table'[employee] = EARLIER ( 'Table'[employee] ) )
)
VAR _2 =
CALCULATE (
COUNTROWS ( 'Table' ),
FILTER ( 'Table', 'Table'[employee] = EARLIER ( 'Table'[employee] ) )
)
RETURN
IF ( _1 = 'Table'[Index], _2, BLANK () )
% =
VAR _1 =
COUNTROWS ( 'Table' )
VAR _2 =
DISTINCTCOUNTNOBLANK ( 'Table'[employee] )
VAR _3 = _1 / _2
VAR _4 =
CALCULATE (
COUNTROWS ( 'Table' ),
FILTER ( 'Table', 'Table'[employee] = EARLIER ( 'Table'[employee] ) )
)
VAR _5 = _4 / _3
VAR _6 =
CALCULATE (
MIN ( 'Table'[Index] ),
FILTER ( 'Table', 'Table'[employee] = EARLIER ( 'Table'[employee] ) )
)
RETURN
IF ( _6 = 'Table'[Index], _5, BLANK () )
Final output:
You can use the AVERAGEX function in a matrix to calculate the average of non-null data. For example, you can use the following formula to calculate the average of non-null data:
AVERAGE TOTAL =
AVERAGEX (
FILTER ( 'Table', NOT ( ISBLANK ( 'Table'[Column] ) ) ),
'Table'[Column]
)
This formula will filter out the null values and then calculate the average of the remaining data.
How to Get Your Question Answered Quickly - Microsoft Fabric Community
If it does not help, please provide more details with your desired out put and pbix file without privacy information.
Best Regards,
Ada Wang
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Hi @MartaBak ,
Depending on the information you have provided, you can follow these steps below:
1.Add an index column.
2.Add two columns.
IP =
VAR _1 =
CALCULATE (
MIN ( 'Table'[Index] ),
FILTER ( 'Table', 'Table'[employee] = EARLIER ( 'Table'[employee] ) )
)
VAR _2 =
CALCULATE (
COUNTROWS ( 'Table' ),
FILTER ( 'Table', 'Table'[employee] = EARLIER ( 'Table'[employee] ) )
)
RETURN
IF ( _1 = 'Table'[Index], _2, BLANK () )
% =
VAR _1 =
COUNTROWS ( 'Table' )
VAR _2 =
DISTINCTCOUNTNOBLANK ( 'Table'[employee] )
VAR _3 = _1 / _2
VAR _4 =
CALCULATE (
COUNTROWS ( 'Table' ),
FILTER ( 'Table', 'Table'[employee] = EARLIER ( 'Table'[employee] ) )
)
VAR _5 = _4 / _3
VAR _6 =
CALCULATE (
MIN ( 'Table'[Index] ),
FILTER ( 'Table', 'Table'[employee] = EARLIER ( 'Table'[employee] ) )
)
RETURN
IF ( _6 = 'Table'[Index], _5, BLANK () )
Final output:
You can use the AVERAGEX function in a matrix to calculate the average of non-null data. For example, you can use the following formula to calculate the average of non-null data:
AVERAGE TOTAL =
AVERAGEX (
FILTER ( 'Table', NOT ( ISBLANK ( 'Table'[Column] ) ) ),
'Table'[Column]
)
This formula will filter out the null values and then calculate the average of the remaining data.
How to Get Your Question Answered Quickly - Microsoft Fabric Community
If it does not help, please provide more details with your desired out put and pbix file without privacy information.
Best Regards,
Ada Wang
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.