Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.
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]))
Solved! Go to Solution.
Hi @Anonymous
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]))
Hi @Anonymous
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]))
Well now I feel embarassed - that fixed it. Thanks !!
Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City
Check out the April 2024 Power BI update to learn about new features.
User | Count |
---|---|
109 | |
98 | |
80 | |
64 | |
57 |
User | Count |
---|---|
145 | |
111 | |
92 | |
84 | |
66 |