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.
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:
Seems all time it calculating measure Bendra_kaina_new just.
Can you reupload a screenshot with the column added to the visual
_op_kiekis[Objektinė apskaita]
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".
Here
I mean, this is saying, that you only have one Tipas that has a Taip for objektiné apskaita
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])
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