Forum Discussion

Druchii's avatar
Druchii
Regular Visitor
4 years ago

Unexpected Expression in various Calculated columns

Hello, im currently working on automatization of debt analysis, and currently im having some issues with some dax calculated columns, all of which appear to work correctly, although a red bar appears in my code editor, and when i put my mouse over the last parenthesis, suddenly it appears a "Unexpected Expression" Message, which messes up my data view tab. Im wondering if having accent marks over my data or columns is the issue here.
The Calculated columns that have this type of issue are:

 

Antiguedad Meses = 
DATEDIFF ( 'Maestro Zuora'[Fecha Emision], EOMONTH ( TODAY(), -1 ), MONTH )
Compañía = 
IF (
    LEFT('Maestro Zuora'[WBE],4) = "CL25",
    "CL25",
    IF(LEFT('Maestro Zuora'[WBE],4) = "CL13","CL13",
    IF('Maestro Zuora'[Cuenta: Legal Entity] = "EnelX","CL25",IF('Maestro Zuora'[Cuenta: Legal Entity] = "EnelDistribucion","CL13","CL36"))
))
Antiguedad Maxima = 
IF (
    'Maestro Zuora'[Número de Factura Asociada]  = BLANK (),
    'Maestro Zuora'[Antiguedad Meses],
    CALCULATE (
        MAX ( 'Maestro Zuora'[Antiguedad Meses] ),
        ALLEXCEPT (
            'Maestro Zuora',
            'Maestro Zuora'[Número de Factura Asociada]
        )
    )
)
Negocio = 
SWITCH(TRUE(),
LEFT('Maestro Zuora'[WBE],8)="CL25E400", "eCity",
LEFT('Maestro Zuora'[WBE],8)="CL25E500", "eHome",
LEFT('Maestro Zuora'[WBE],8)="CL25E600", "eIndustry",
LEFT('Maestro Zuora'[WBE],8)="CL25E700", "eMobility",
LEFT('Maestro Zuora'[WBE],8)="CL13E400", "eCity",
LEFT('Maestro Zuora'[WBE],8)="CL13E500", "eHome",
LEFT('Maestro Zuora'[WBE],8)="CL13E600", "eIndustry",
LEFT('Maestro Zuora'[WBE],8)="CL13E700", "eMobility",
"NA"
)

 

 

This is the data model i'm working on:

And Also the error message:

And finally here's how this messes up my dataview tab

2 Replies

  • Anonymous's avatar
    Anonymous
    Not applicable

    Hi Druchii ,

     

    Please share some sample data so that we could test the formula.

     

    Best Regards,

    Jay

  • I am having a similar problem with the red bar. Have you been able to find out what it means? The best explanation I have been able to piece together is that the editor is expecting the first parameter to be tabular and is receiving something that is scalar or vice versa, but this is just a guess. I have not been able to find a true answer anywhere.