cancel
Showing results for
Did you mean:
Highlighted
Helper III

## Use measure within another measure

I have the following measures and I need a new measure called Net that is CurrentYear - PriorYear. Can I create this measure without repeating the formulas of the prior two...something like [CurrentYear] - [PriorYear] or something? All three of these will be used in a matrix with values over 12 months. Thanks.

CurrentYear = Format(
CALCULATE(sum(Sheet1[FinancialAmount]), filter(Sheet1, Sheet1[FinancialType]= "Current")),
"\$#,##0;(\$#,##0)"
)

PriorYear = Format(
CALCULATE(sum(Sheet1[FinancialAmount]), filter(Sheet1, Sheet1[FinancialType]= "Prior")),
"\$#,##0;(\$#,##0)"
)

1 ACCEPTED SOLUTION

Accepted Solutions
Highlighted
Resolver I

## Re: Use measure within another measure

Try to do VARIABLES within measures like below:

% YoY Sales =

VAR CURRENT_SALES = SUM(SALES)

VAR PRIOR_SALES = CALCULATE(SUM(SALES);SAMEPERIODLASTYEAR(DATES))

Return

DIVIDE ( CURRENT_SALES - PRIOR_SALES; PRIOR_SALES)

Best regards,

3 REPLIES 3
Highlighted
Continued Contributor

## Re: Use measure within another measure

Once you have created measures you can use them inside others measures. Also you can change the context of them.

Thanks,

Ricardo

Highlighted
Helper III

## Re: Use measure within another measure

Thanks...I came in today and looked at my question. I think I was trying to do something a little more complicated and didnt address the question correctly. I know you can do that with measures...must have had a brain f@rt. Thanks.

Highlighted
Resolver I

## Re: Use measure within another measure

Try to do VARIABLES within measures like below:

% YoY Sales =

VAR CURRENT_SALES = SUM(SALES)

VAR PRIOR_SALES = CALCULATE(SUM(SALES);SAMEPERIODLASTYEAR(DATES))

Return

DIVIDE ( CURRENT_SALES - PRIOR_SALES; PRIOR_SALES)

Best regards,

Announcements

#### August 2020 Community Challenge: Can You Solve These?

We're excited to announce our first cross-community 'Can You Solve These?' challenge!

#### Community Blog

Visit our Community Blog for articles, guides, and information created by fellow community members.

#### Upcoming Events

Wondering what events you could join or have an event to promote yourself? Check out our Upcoming Events.

#### Community Summit Australia – Join Online!

Be a part of the leading Microsoft Business Applications digital event, curated for the APAC community.

Top Solution Authors
Top Kudoed Authors