Forum Discussion
SWITCH-IF and BLANKS.
Hello everyone!
I have a budget for my supplies. There are some budgeted supplies that, later on, aren't used. So, when returning values I'm doing the following:
1) First I store in a var each budget (ppto).
2) Then I apply this return formula:
return IF (ISBLANK([Total factura consumo]),BLANK(),SWITCH(selectedConsumo,
"Electricidad",pptoLuz+0,
"Carburante", pptoCarburante+0,
"Telefonía", pptoTelefoniaT+0,
"Gas natural", pptoGas+0,
"Agua consumo",pptoAgua+0,
"Gasoil", pptoGasoil+0,
pptoAgua+pptoCarburante+pptoGas+pptoGasoil+pptoLuz+pptoTelefoniaT
))
But my problem is that, if there's no consumption (Total factura consumo) in the matrix, I get a wrong value for the subtotal since it sums all things budgeted. Is there anyway to deal with selection? I mean, if only one is selected it is working right, but if I select two or more, it starts to sum everything (whether is a value on consumption or not).
I don't know if I have made myself clear.
Thank you in advance
7 Replies
- ChiragGarg2512
Solution Sage
mlsx4 , it will continue to do so, what can be done is add some column for creating a distinction.
Also change
ISBLANK([Total factura consumo])to
ISBLANK([Total factura consumo]) || [Total factura consumo]<>0Thank You
- mlsx4
Memorable Member
If I change to the line you have written it gets worse:
This is a center. This month I only have consumption for electricity and gas (which are normal values), so the subtotal should be: 6100€ but as you can see, subtotal and other values return the sum of total budgeted.
- ChiragGarg2512
Solution Sage
mlsx4 What happens with switch statement is only one value is selected and if two are selected the situation will go to else response.
For this work, multiple IF statements have to be used and based on that values will be added.