Forum Discussion
Create a variable in PowerBI with a filter
Hello Wonderful People
Please can someone point out the error in my syntax because PB error message for syntax is useless (or me?). Thank you in advance.
Hi Anonymous
After Retun need to specify variable or a calculation you want to return
check the below measuretest =
Var test =
CALCULATE(
SUM('Payment Report Template'[Payment Amount]),
FILTER('Payment Report Template','Payment Report Template'[Payment Type]="Practical Completion")
)
RETURN testIf this post helps, then please consider Accept it as the solution, Appreciate your Kudos!!
5 Replies
- JayeeResponsive Resident
Hi Anonymous
After Retun need to specify variable or a calculation you want to return
check the below measuretest =
Var test =
CALCULATE(
SUM('Payment Report Template'[Payment Amount]),
FILTER('Payment Report Template','Payment Report Template'[Payment Type]="Practical Completion")
)
RETURN testIf this post helps, then please consider Accept it as the solution, Appreciate your Kudos!!
- AnonymousNot applicable
Another question:
I am trying to create a variable which contains multiple variables but the syntax contains errors that I can't tell:GFA_test =VAR pc_as20_test =CALCULATE(DISTINCTCOUNT('Weekly Report Template'[D_Code]),FILTER('Weekly Report Template', 'Weekly Report Template'[Application Stage] =" 20 Funding Agreement Signed"))VAR pc_as21_test =CALCULATE(DISTINCTCOUNT('Weekly Report Template'[D_Code]),FILTER('Weekly Report Template', 'Weekly Report Template'[Application Stage] =" 21 On Site Monitoring"))VAR pc_as22_test =CALCULATE(DISTINCTCOUNT('Weekly Report Template'[D_Code]),FILTER('Weekly Report Template', 'Weekly Report Template'[Application Stage] ="22 Practical Completion - Retention Period (12m)"))VAR pc_as23_test =CALCULATE(DISTINCTCOUNT('Weekly Report Template'[D_Code]),FILTER('Weekly Report Template','Weekly Report Template'[Application Stage] ="23 Retention Payment - Application Closed"))- JayeeResponsive Resident
One question per ticket please. If you need to extend your request then please raise a new ticket.
You will get a quicker response and each volunteer solver will get the kudos they deserve.
Thank you !
- serpiva64Solution Sage
Hi,
you missed to write the var after Return (test)
- AnonymousNot applicable
Thank you for your quick response! The syntax is now working.