Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

July 7 - July 17 | Round 2 of the Power BI Dataviz World Championships. Don't miss your chance! Learn more

Reply
pvaldiviag
New Member

Bad calculation using IF (Matrix)

Hello,

Im using this formula

Ventas$N =
IF([SUBS_C],
//TRUE
DIVIDE(TOTALYTD(SUM(Metricas[Monto]),Tiempo[Fecha],'Terminos Financieros'[TF_id]=25),CALCULATE(SUM(Tiempo[TipoCambio])),"ERROR"),
//FALSE
TOTALYTD(SUM(Metricas[Monto]),Tiempo[Fecha],'Terminos Financieros'[TF_id]=25))

To calculate sale amounts for different companies with different curriencies.

If the company has a different currency, I divide it by the current exchange rate, if not, then i'll just show the regular amount.

 

I get this result.

 

error 1.PNG

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

As you can see the totals (bold numbers) are not adding up correctly. Is the problem my formula or DAX justs doesnt like me?

Help please.

 

Thanks in advance.

2 REPLIES 2
Baskar
Resident Rockstar
Resident Rockstar

Hi Pvaldiviag,

 

There is no prob with your formula, this the prob on power bi Total, Its nature is calculate entire sum. 

I think in prob on power bi end....

Vvelarde
Community Champion
Community Champion

Hi @pvaldiviag

 

Probably is not the best solution.

 

Assuming that you have a

 

Calculated Column called  "Cambio de Moneda" where 1 = Applied exchange rate, 0=Don't Apply Exchange Rate.

 

After this create a new table:

 

Montos-Convertidos = summarize('Companies-Details';'Companies-Details'[COMPANY];"MONTO";if(min('Companies-Details'[CAMBIO-DE-MONEDA])=0;sum('Companies-Details'[MONTO]);DIVIDE(sum('Companies-Details'[MONTO]);3.3)))

 

Made a relationship between tables Companies-Details and Montos-Convertidos by field =Company

 

Use field Montos-Convertidos as Value in a Matrix.

 

Edit: Replace 3.3 with your Exchange Rate Field

 




Lima - Peru

Helpful resources

Announcements
FabCon and SQLCon Barcelona 2026

FabCon & SQLCon – Barcelona 2026

Join us in Barcelona for FabCon and SQLCon, the Fabric, Power BI, SQL, and AI community event. Save €200 with code FABCMTY200.

60 days of Data Days Carousel

Data Days 2026

Join Data Days 2026: 60 days of free live/on-demand sessions, challenges, study groups, and certification opportunities.

Power BI DataViz World Championships carousel

Power BI DataViz World Championships - June 2026

A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.

Top Solution Authors