Forum Discussion
Calculated column not working
Dear All,
I have the following calculated column:
var SUPPLIERS = CALCULATE(SUM(Cashflow[Importo (+/-)]),Cashflow[Source]=0, Cashflow[Categoria]="FORNITORI")
var PREVISIONE_FORNITORI_CURRENT = Cashflow[Source]=5 && Cashflow[Completed_month]=0 && Cashflow[Par1]=1
var CLIENTS = CALCULATE(SUM(Cashflow[Importo (+/-)]),Cashflow[Source]=0, Cashflow[Categoria]="CLIENTI")
var PREVISIONE_CLIENTI_CURRENT = Cashflow[Source]=5 && Cashflow[Completed_month]=0 && Cashflow[Par1]=0
var PREVISIONALE_PAST = Cashflow[Source]=5 && Cashflow[Completed_month]=1
RETURN
IF( PREVISIONALE_PAST, 0, IF(PREVISIONE_FORNITORI_CURRENT, Cashflow[Importo (+/-)] - SUPPLIERS, IF(PREVISIONE_CLIENTI_CURRENT, Cashflow[Importo (+/-)] - CLIENTS, Cashflow[Importo (+/-)])))
Problem is the var in red do not works (it doesn't subtract anything).
Do you have any recommendations?
Thank you a lot
5 Replies
- mlsx4Memorable Member
What do you want to calculate, the sum of importo when source is 0 or the category is "Fornitori"? In this case, you can try: var SUPPLIERS = CALCULATE(SUM(Cashflow[Importo (+/-)]), Cashflow[Source]=0 || Cashflow[Categoria]="FORNITORI").
Also check the type of data for both columns.
- gianmarcoHelper IV
Actually I want to calculate the sum of importo when source is 0 and category is "Fornitori".
Is that a problem?
- mlsx4Memorable Member
Change the "||" by "&&" operator. Anyway, your measure shouldn't be a problem.
I have checked with a simple example and it is working right
Try to check return SUPPLIERS. (Comment the two lines you have right now). If it computes the value, the problem is in your IF condition