Forum Discussion
ContabilidadBI
9 years agoHelper III
Problem calculating PROFIT with header and detail Fact Tables.
Good morning guys, I am relatively new to Power BI and DAX and I am having a problem trying to calculate the PROFIT (and PROFIT %) with the following data model with 2 sales tables. First the...
- 9 years ago
Hi ContabilidadBI,
I took Facturas[Dto] as unit value. You could try this formula.
net profit € = SUM ( 'FactLineas'[Ingresos] ) - SUMX ( FactLineas, FactLineas[Cantidad] * FactLineas[PrecioCoste] ) - SUM ( 'Facturas'[Dto] ) - SUM ( 'Rappel'[Rappel] )profit % = DIVIDE ( [net profit €], SUM ( 'FactLineas'[Ingresos] ), 0 )
Best Regards!
Dale
v-jiascu-msft
9 years agoMicrosoft Employee
Hi ContabilidadBI,
I took Facturas[Dto] as unit value. You could try this formula.
net profit € =
SUM ( 'FactLineas'[Ingresos] )
- SUMX ( FactLineas, FactLineas[Cantidad] * FactLineas[PrecioCoste] )
- SUM ( 'Facturas'[Dto] )
- SUM ( 'Rappel'[Rappel] )
profit % = DIVIDE ( [net profit €], SUM ( 'FactLineas'[Ingresos] ), 0 )
Best Regards!
Dale
ContabilidadBI
9 years agoHelper III
Hi v-jiascu-msft,
It works like a charm, thank you very much. It was very easy formula at the end! I thought it couldn't be so simple. I always forget that the current context plays a huge role in DAX formulas.
Best Regards!
Víctor