cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
Helper II
Helper II

VAR stopped working after update

I had numerous measures using the VAR keyword in Power BI that worked fine until the last update in November. I found that I could fix the issue by just altering the syntax just a little bit (I think i added a space, something not intuitive... took me hours to figure it out). Any ways, I'm using the same logic for a new measure in Power BI. once again, it's now not working. This is the same logic I've used on previous measures using VAR. Can someone please help me? This is incredibly frustrating. 

 

The syntax is below. The error I get is "The syntax for 'RETURN' is incorrect" followed by a long string of text. Below is the measure formula I am using. I am trying to use the VAR MaxDate to filter my selection of data. 

 

UL % Curr Mo = VAR MaxDate = MAX('Loss Cat Data'[PE FC MoYr] RETURN CALCULATE(SUM('Loss Cat Data'[Potential]), 'Loss Cat Name'[Loss Type] = "U", 'Loss Cat Data'[PE FC MoYr] = DATE(YEAR(MaxDate), MONTH(MaxDate), DAY(MaxDate))) / CALCULATE(SUM('Loss Cat Data'[Potential]))

1 ACCEPTED SOLUTION

Accepted Solutions
Highlighted
Super User I
Super User I

Re: VAR stopped working after update

Hi @jtmize

 

On my first look I saw a missing ) in VAR highlighted in RED below

 

UL % Curr Mo = VAR MaxDate = MAX('Loss Cat Data'[PE FC MoYr]) RETURN CALCULATE(SUM('Loss Cat Data'[Potential]), 'Loss Cat Name'[Loss Type] = "U", 'Loss Cat Data'[PE FC MoYr] = DATE(YEAR(MaxDate), MONTH(MaxDate), DAY(MaxDate))) / CALCULATE(SUM('Loss Cat Data'[Potential]))

Regards,
Zubair


View solution in original post

2 REPLIES 2
Highlighted
Super User I
Super User I

Re: VAR stopped working after update

Hi @jtmize

 

On my first look I saw a missing ) in VAR highlighted in RED below

 

UL % Curr Mo = VAR MaxDate = MAX('Loss Cat Data'[PE FC MoYr]) RETURN CALCULATE(SUM('Loss Cat Data'[Potential]), 'Loss Cat Name'[Loss Type] = "U", 'Loss Cat Data'[PE FC MoYr] = DATE(YEAR(MaxDate), MONTH(MaxDate), DAY(MaxDate))) / CALCULATE(SUM('Loss Cat Data'[Potential]))

Regards,
Zubair


View solution in original post

Highlighted
Helper II
Helper II

Re: VAR stopped working after update

Well now I feel embarassed - that fixed it. Thanks !!

Helpful resources

Announcements
Community Conference

Power Platform Community Conference

Check out the on demand sessions that are available now!

Community Conference

Microsoft Power Platform Communities

Check out the Winners!

secondImage

Power Platform 2020 release wave 2 plan

Features releasing from October 2020 through March 2021

Tech Marathon

Maratón de Soluciones de Negocio Microsoft

Una semana de contenido con +100 sesiones educativas, consultorios, +10 workshops Premium, Hackaton, EXPO, Networking Hall y mucho más!

Top Solution Authors
Top Kudoed Authors