The ultimate Fabric, Power BI, SQL, and AI community-led learning event. Save €200 with code FABCOMM.
Get registeredEnhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.
I need help with Power Bi function.
So I have many order numbers that are sometimes repeated in many rows.
Factor = columnx/columny
I want to calculate column that shows factor for specific order number not for row.
Order number 213 (2+6+15)/(2+2+3) = 3,28
Order number | columnx | columny | Factor |
213 | 2 | 2 | 3,28 |
213 | 6 | 2 | 3,28 |
213 | 15 | 3 | 3,28 |
214 | 20 | 4 | 3,5 |
214 | 8 | 4 | 3,5 |
215 | 4 | 2 | 2 |
216 | 18 | 9 | 2,36 |
216 | 8 | 2 | 2,36 |
I have the biggest problem to make caclucation for specific order number. Any ideas how to calculate it?
Thanks,
Aleks
Solved! Go to Solution.
Hi @Anonymous ,
Please create a new column:
Column =
var sum_columnx = CALCULATE(SUM('Table'[columnx]),FILTER(ALL('Table'),'Table'[Order number] = EARLIER('Table'[Order number])))
var sum_columny = CALCULATE(SUM('Table'[columny]),FILTER(ALL('Table'),'Table'[Order number] = EARLIER('Table'[Order number])))
return
DIVIDE(sum_columnx,sum_columny)
Result:
Best regards,
Yadong Fang
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Hi @Anonymous ,
Please create a new column:
Column =
var sum_columnx = CALCULATE(SUM('Table'[columnx]),FILTER(ALL('Table'),'Table'[Order number] = EARLIER('Table'[Order number])))
var sum_columny = CALCULATE(SUM('Table'[columny]),FILTER(ALL('Table'),'Table'[Order number] = EARLIER('Table'[Order number])))
return
DIVIDE(sum_columnx,sum_columny)
Result:
Best regards,
Yadong Fang
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.