Search code examples
powerbidaxdata-analysispowerbi-desktopmeasure

Using Measure as Variable


The following measure works, but rather than making separate measures for each year, I want to use a variable in place of 2022.
Q1FY22 Cost = CALCULATE( SUM('Invoice Amounts'[CLIN Total]),'Calendar'[Fiscal Year]=2022,'Calendar'[Fiscal Quarter]=1)

I created another measure,

ThisFY=2022

When I substitute in the original,

Q1FY22 Cost = CALCULATE(
    SUM('Invoice Amounts'[CLIN Total]),'Calendar'[Fiscal Year]=[ThisFY],'Calendar'[Fiscal Quarter]=1)

I receive the error: A function 'PLACEHOLDER' has been used in a True/False expression that is used as a table filter expression. This is not allowed.


Solution

  • This is a lineage issue.

    Try this.

    Q1FY22 Cost = CALCULATE(
        SUM('Invoice Amounts'[CLIN Total]), TREATAS( {[ThisFY]}, 'Calendar'[Fiscal Year]),'Calendar'[Fiscal Quarter]=1)