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

Be one of the first to start using Fabric Databases. View on-demand sessions with database experts and the Microsoft product team to learn just how easy it is to get started. Watch now

Reply
CarlosPelay
Frequent Visitor

Error Using a Dax Measure as a constant

Hi I have a dash with a number of measures filtered by the current fiscal year. 

 

I'd like to save the value of the current fiscal year in a Dax measure and then use that measure as a sort of constant to filter all my other measures.  That way I only have to update the value of the one constant measure every year instead of all the other measures.

 

For example:

 

__CURRENT CAMPAIGN YR = "FY25"
 
and then
 
Appeals_Total$_SPONSORSHIP = CALCULATE(SUM('Final_RE_Gift Detail'[Appeal Split Amount]),'Final_RE_Gift Detail'[Appeal]="BBFC Sponsorship",'Final_RE_Gift Detail'[Campaign]=[__CURRENT CAMPAIGN YR])
 
But this gives me the following error:
 
CarlosPelay_0-1730305559676.png

 

However, this works:

 

Appeals_Total$_SPONSORSHIP = CALCULATE(SUM('Final_RE_Gift Detail'[Appeal Split Amount]),'Final_RE_Gift Detail'[Appeal]="BBFC Sponsorship",'Final_RE_Gift Detail'[Campaign]="FY24")
 

Any suggestions as to how I can implement this correctly?

 

Thank you.

1 ACCEPTED SOLUTION
v-linhuizh-msft
Community Support
Community Support

Thanks for the reply from lbendlin.

 

Hi @CarlosPelay,

 

As lbendlin says, when we try to use a measure as a filter in another measure, a syntax error occurs because the measure cannot be calculated as a fixed constant value.

To solve this problem, we can use a variable in the second measure to store the value of __CURRENT CAMPAIGN YR.

Please use the following DAX:

 

Appeals_Total$_SPONSORSHIP = 
VAR _a=[__CURRENT CAMPAIGN YR]
RETURN
CALCULATE(SUM('Final_RE_Gift Detail'[Appeal Split Amount]),'Final_RE_Gift Detail'[Appeal]="BBFC Sponsorship",'Final_RE_Gift Detail'[Campaign]=_a)

 

 

Best Regards,
Zhu

 

If there is any post helps, then please consider Accept it as the solution  to help the other members find it more quickly.

View solution in original post

3 REPLIES 3
v-linhuizh-msft
Community Support
Community Support

Thanks for the reply from lbendlin.

 

Hi @CarlosPelay,

 

As lbendlin says, when we try to use a measure as a filter in another measure, a syntax error occurs because the measure cannot be calculated as a fixed constant value.

To solve this problem, we can use a variable in the second measure to store the value of __CURRENT CAMPAIGN YR.

Please use the following DAX:

 

Appeals_Total$_SPONSORSHIP = 
VAR _a=[__CURRENT CAMPAIGN YR]
RETURN
CALCULATE(SUM('Final_RE_Gift Detail'[Appeal Split Amount]),'Final_RE_Gift Detail'[Appeal]="BBFC Sponsorship",'Final_RE_Gift Detail'[Campaign]=_a)

 

 

Best Regards,
Zhu

 

If there is any post helps, then please consider Accept it as the solution  to help the other members find it more quickly.

Thanks Zhu!  This was very helpful

lbendlin
Super User
Super User


You cannot measure a measure directly. Either materialize it first, or create separate measures that implement the entire business logic.

Helpful resources

Announcements
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!

Dec Fabric Community Survey

We want your feedback!

Your insights matter. That’s why we created a quick survey to learn about your experience finding answers to technical questions.

ArunFabCon

Microsoft Fabric Community Conference 2025

Arun Ulag shares exciting details about the Microsoft Fabric Conference 2025, which will be held in Las Vegas, NV.

December 2024

A Year in Review - December 2024

Find out what content was popular in the Fabric community during 2024.