Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.
Hello,
I am looking to add a column which has average value of my data across the row, excluding values below 0.
Row 1 value would be DATA1+DATA2+DATA3+DATA4 / SUBSIZE
Row 2 value would be DATA1+DATA2+DATA3+DATA4+DATA5+DATA6 / SUBSIZE
Thanks in advance for any advice!
Solved! Go to Solution.
@SofaQueen if my previous reply is the use case to calculate avg then add a column using the following expression.
Avg =
DIVIDE(
Table[Data1] + Table[Data2] + Table[Data3] + Table[Data4] +
IF ( Table[SubSize] = 6, Table[Data5] + Table[Data6], 0 ),
Table[Subsize]
)
Would appreciate Kudos 🙂 if my solution helped. Ask anything Power BI. Book appointment for a free consultancy at https://www.perytus.com
Subscribe to the @PowerBIHowTo YT channel for an upcoming video on List and Record functions in Power Query!!
Learn Power BI and Fabric - subscribe to our YT channel - Click here: @PowerBIHowTo
If my solution proved useful, I'd be delighted to receive Kudos. When you put effort into asking a question, it's equally thoughtful to acknowledge and give Kudos to the individual who helped you solve the problem. It's a small gesture that shows appreciation and encouragement! ❤
Did I answer your question? Mark my post as a solution. Proud to be a Super User! Appreciate your Kudos 🙂
Feel free to email me with any of your BI needs.
You can try using the following function:
Average =
VAR vDataPoint1 = IF(DATA1 > 0, DATA1, 0)
VAR vDataPoint2 = IF(DATA2 > 0, DATA2, 0)
...
VAR vDataPoint6 = IF(DATA6 > 0, DATA6, 0)
RETURN (vDataPoint1 + vDataPoint2 + ... + vDataPoint6 ) / SUBSIZE
You can try using the following function:
Average =
VAR vDataPoint1 = IF(DATA1 > 0, DATA1, 0)
VAR vDataPoint2 = IF(DATA2 > 0, DATA2, 0)
...
VAR vDataPoint6 = IF(DATA6 > 0, DATA6, 0)
RETURN (vDataPoint1 + vDataPoint2 + ... + vDataPoint6 ) / SUBSIZE
@SofaQueen what is the logic to add data 1 to 4 in first row and data 1 to 6 column in 2nd row, is it defined based on value in subsize column?
Subscribe to the @PowerBIHowTo YT channel for an upcoming video on List and Record functions in Power Query!!
Learn Power BI and Fabric - subscribe to our YT channel - Click here: @PowerBIHowTo
If my solution proved useful, I'd be delighted to receive Kudos. When you put effort into asking a question, it's equally thoughtful to acknowledge and give Kudos to the individual who helped you solve the problem. It's a small gesture that shows appreciation and encouragement! ❤
Did I answer your question? Mark my post as a solution. Proud to be a Super User! Appreciate your Kudos 🙂
Feel free to email me with any of your BI needs.
Hi @parry2k . There is no logic. This is raw measurement data from a software database. The SUBSIZE column is populated based on the quantity of values that is entered into that system. If no value is input, the <null> has translated into that -1.6E+98 amount when synced w/ PBI.
@SofaQueen if my previous reply is the use case to calculate avg then add a column using the following expression.
Avg =
DIVIDE(
Table[Data1] + Table[Data2] + Table[Data3] + Table[Data4] +
IF ( Table[SubSize] = 6, Table[Data5] + Table[Data6], 0 ),
Table[Subsize]
)
Would appreciate Kudos 🙂 if my solution helped. Ask anything Power BI. Book appointment for a free consultancy at https://www.perytus.com
Subscribe to the @PowerBIHowTo YT channel for an upcoming video on List and Record functions in Power Query!!
Learn Power BI and Fabric - subscribe to our YT channel - Click here: @PowerBIHowTo
If my solution proved useful, I'd be delighted to receive Kudos. When you put effort into asking a question, it's equally thoughtful to acknowledge and give Kudos to the individual who helped you solve the problem. It's a small gesture that shows appreciation and encouragement! ❤
Did I answer your question? Mark my post as a solution. Proud to be a Super User! Appreciate your Kudos 🙂
Feel free to email me with any of your BI needs.
Perfecto! Thank you so very much!
Hi, One way to obtain the SUM without 0 is this:
Av =
VAR _tempTable =
FILTER (
UNION (
ROW ( "Rating"; 'Table'[RatingA] );
ROW ( "Rating"; 'Table'[Rating B] );
ROW ( "Rating"; 'Table'[Rating C] )
);
[Rating] >= 0
)
RETURN
SUMX ( _tempTable; [Rating] )
Another will be with IF
AV=IF('Table'[Data1] >=0;Table'[Data1];0) +IF('Table'[Data2] >=0;Table'[Data2];0) ..............
Regards
Victor
Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City
Check out the April 2024 Power BI update to learn about new features.
User | Count |
---|---|
104 | |
101 | |
79 | |
72 | |
64 |
User | Count |
---|---|
143 | |
109 | |
103 | |
82 | |
74 |