Starting December 3, join live sessions with database experts and the Microsoft product team to learn just how easy it is to get started
Learn moreGet certified in Microsoft Fabric—for free! For a limited time, get a free DP-600 exam voucher to use by the end of 2024. Register now
I am trying to calculate an average based on number of transactions and #days to complete.
The dataset looks like
TX_CNT DAYS_TO_COMPLETE
5 13
2 5
1 3
So the average days to complete by transaction is 9.75 = ((13*5)+(5*2)+(3x1)) / (5+2+1)
I have this data in one table coming from SQL.
How can I calculate the average across rows while considering the TX_CNT.
FYI I have other attributes in the table which I'll use for legend, slicers etc... but I am trying to create a measure I can use.
Thank you!
Solved! Go to Solution.
Hi @ChristianR
If your table contains the two columns shown, you can write a measure like this to perform the weighted-average calculation:
Average days =
DIVIDE (
SUMX (
YourTable,
YourTable[TX_CNT] * YourTable[DAYS_TO_COMPLETE]
),
SUM ( YourTable[TX_CNT] )
)
Does that work for you?
Regards,
Owen
Hello @ChristianR ,
Create a below two measures
Hi @ChristianR
If your table contains the two columns shown, you can write a measure like this to perform the weighted-average calculation:
Average days =
DIVIDE (
SUMX (
YourTable,
YourTable[TX_CNT] * YourTable[DAYS_TO_COMPLETE]
),
SUM ( YourTable[TX_CNT] )
)
Does that work for you?
Regards,
Owen
Starting December 3, join live sessions with database experts and the Fabric product team to learn just how easy it is to get started.
March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount! Early Bird pricing ends December 9th.
User | Count |
---|---|
92 | |
86 | |
84 | |
66 | |
49 |
User | Count |
---|---|
140 | |
113 | |
106 | |
64 | |
60 |