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

Enhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.

Reply
Analitika
Post Prodigy
Post Prodigy

Wrong calculation in visual in Power BI

Hello,

 

Getting wrong output when trying to calculate sum according to table column value. 

 

bendra_suma_ar_objektine5 = 
  SWITCH (
      TRUE (),
      MAX(_op_kiekis[Objektinė apskaita])="Taip",[Bendra kaina_new],
      [Bendra kaina_new_be_obj]
      
)

 

Here is a formula.

 

Here is a visual with marked wrong calculated rows:

Analitika_0-1655444195846.png

Seems all time it calculating measure Bendra_kaina_new just.

7 REPLIES 7
NickolajJessen
Solution Sage
Solution Sage

Can you reupload a screenshot with the column added to the visual

_op_kiekis[Objektinė apskaita]

 

Analitika_0-1655445458180.png

Here is a marked rows with mismatches per row, just total matches.

 

Here. Seems first column value matches second coumn total but looking at each row see some mismatch.

To me, it looks like it's working as intended.
You're asking it return bedra kaine_new_be_obj, which it does. The only case, where it should return bedra kaina_new is when the objectine is taip, which is only the case at the 0,0,0 row.

Is not ok, because I saw "Ne" in objektine apskaita column.

 

bendra_suma_ar_objektine6 = 
  if(FIRSTNONBLANK(_op_kiekis[Objektinė apskaita],1)="Taip",[Bendra kaina_new],[Bendra kaina_new_be_obj])
     

I tried to use this formula but it always returns bendra_kaina_new_be_obj even objektine apskaita column contains "Taip".

Analitika_0-1655446951770.png

Here

I mean, this is saying, that you only have one Tipas that has a Taip for objektiné apskaita

NickolajJessen_0-1655447170986.png

Maybe you have some filters on, that are sorting out these values or incorrect relationships

I also tried this formula:

 

bendra_suma_ar_objektine6 = 
  if(FIRSTNONBLANK(_op_kiekis[Objektinė apskaita],1)="Taip" || FIRSTNONBLANK(_op_kiekis[Objektinė apskaita],1)="",[Bendra kaina_new],[Bendra kaina_new_be_obj])
     

Analitika_0-1655447822464.png

 

 

But it calculates using Bendra_kaina_new even objektine apskaita is "Ne".

 

If i were you, i'd try and troubleshoot this part a bit:

FIRSTNONBLANK(_op_kiekis[Objektinė apskaita],1)

Try to make it return your desired result for each row

Helpful resources

Announcements
August Power BI Update Carousel

Power BI Monthly Update - August 2025

Check out the August 2025 Power BI update to learn about new features.

August 2025 community update carousel

Fabric Community Update - August 2025

Find out what's new and trending in the Fabric community.

Top Solution Authors