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

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.

Reply
Kemir
New Member

Use a measure in other measure

Hello,

 

I need to make a measure, the difference of the revenue with the largest year in the filter less the previous year and I have 6 different years.

 

I have this:

 

Max year(measure) = Calculate the largest year of the column

Max year-1(measure) = Calculate the previous year of the largest.

 

And this is the new measure that I am trying to do:

 

Var Years = (CALCULATE(SUM(BD[Revenue]),BD[Year Report]=[MAX YEAR])) - (CALCULATE(SUM(BD[Revenue]),BD[Year Report]=[MAX YEAR-1]))

 

Thanks!

1 ACCEPTED SOLUTION
KHorseman
Community Champion
Community Champion

You are using measures as filter criteria. I believe that has to be nested inside an explicit FILTER() statement.

 

Your Measure = CALCULATE([Whatever], [Measure] = "x")

 

Correct Measure = CALCULATE([Whatever], FILTER(TableName, [Measure] = "x"))





Did I answer your question? Mark my post as a solution!

Proud to be a Super User!




View solution in original post

7 REPLIES 7
v-shex-msft
Community Support
Community Support

Hi @Kemir,


I think you can take a look at below link which about the compare between two years:

Comparing this year and last year measure on a bar chart

 

Regards,

Xiaoxin sheng

Community Support Team _ Xiaoxin
If this post helps, please consider accept as solution to help other members find it more quickly.
GilbertQ
Super User
Super User

Hi there, what is the error you are getting or what are you not being able to see?

If you have any screenshots to show, would be ideal.




Did I answer your question? Mark my post as a solution!

Proud to be a Super User!







Power BI Blog

Hi,

 

The calculate would be for the 5 different years.

 

 2017-07-21 11_52_20-Clipboard.png2017-07-21 11_53_01-Clipboard.png

KHorseman
Community Champion
Community Champion

You are using measures as filter criteria. I believe that has to be nested inside an explicit FILTER() statement.

 

Your Measure = CALCULATE([Whatever], [Measure] = "x")

 

Correct Measure = CALCULATE([Whatever], FILTER(TableName, [Measure] = "x"))





Did I answer your question? Mark my post as a solution!

Proud to be a Super User!




It does not work yet.

 

This is my measure:

 

My Measure: = (CALCULATE(SUM(BD[Revenue]),BD[Year Report]=MAX(BD[Year Report])) - CALCULATE(SUM(BD[Revenue]),BD[Year Report]=(MAX(BD[Year Report])-1)) )

 

I need that the criteria would be the largest number in the column.

 

2017-07-21 14_08_53-Clipboard.png

Thanks!

 

All right!!!

KHorseman
Community Champion
Community Champion

Well it won't work if you don't actually do what I said...





Did I answer your question? Mark my post as a solution!

Proud to be a Super User!




Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.