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

Earn a 50% discount on the DP-600 certification exam by completing the Fabric 30 Days to Learn It challenge.

Reply
Druchii
Regular Visitor

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:

Druchii_0-1660167334115.png

And Also the error message:UE1.png

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

2 REPLIES 2
mktganalyst5050
Frequent Visitor

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.

v-jayw-msft
Community Support
Community Support

Hi @Druchii ,

 

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

 

Best Regards,

Jay

Community Support Team _ Jay
If this post helps, then please consider Accept it as the solution
to help the other members find it.

Helpful resources

Announcements
PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.