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

Grow your Fabric skills and prepare for the DP-600 certification exam by completing the latest Microsoft Fabric challenge.

Reply
twixraider
Frequent Visitor

difference of the same measure between time

I need help to show the difference of a measure between different Dates. 
I already tried this here Difference between two columns or rows , but this doesn't work with measures only with tables.
difference of the same measure between time.pngHope that someone can help me here.

 

 

 

 

2 ACCEPTED SOLUTIONS

Please try again.

 

DEF = [Average PP]-CALCULATE([Average PP], SAMEPERIODLASTYEAR('Calendar'[Date]))

 

Did you make a calendar table?

View solution in original post

How about this formula?

 

DEF = [Average PP]-CALCULATE([Average PP], PREVIOUSYEAR('Calendar'[Date]))

View solution in original post

11 REPLIES 11
twixraider
Frequent Visitor

Hello mickey64,
I had overlooked that you had adjusted your formula in your last post and this one works beautifully. Thank you very much you have helped me a lot.

mickey64
Super User
Super User

For your reference.

 

Step 1: I make calendar table and add relationship. 

 

Step 2: I make a mesure below.

    DEF = SUM([Average PP])-CALCULATE(SUM([Average PP]),SAMEPERIODLASTYEAR('Calendar'[Date]))

Thank you mickey64,

but unfortunately this doesn't work. Average APP is already a measure and it does not let me use the measure in this formular. I tried to implement the formular of the measure instead, but this doesn't work. This is the formular used in the measure: 

Average PP = DIVIDE(SUM('Sales Group'[Summe MEK EUR]), SUM('Sales Group'[Menge])). Maybe this helps.

Please try again.

 

DEF = [Average PP]-CALCULATE([Average PP], SAMEPERIODLASTYEAR('Calendar'[Date]))

 

Did you make a calendar table?

Hi mickey64,
now I was too hasty. Unfortunately, your formula does not work. It does calculate, but the result is not correct, but now I do not know why that is. Sometimes it is at least close but then sometimes completely off. 

twixraider_0-1695371183140.png

 

If you could paste the data you are using for aggregation in text format, I might be able to figure out the cause.

Or, do you show me the model view?

Hi mickey64

I got the solution, thanks to your formular, I also have the average price

= CALCULATE([Average PP],SAMEPERIODLASTYEAR('dwh DimDate'[Date]))

from last year for the same periode, so I do not need my average, I just take yours. Problem solved. Thank you!!

Hi mickey64,

I found out where the problem is and it was actually staring at me the whole time. The problem is, to calculate the average purchase price, I just divide by the quantity and then I get an average price for the entire current year and the entire past year, but with your formula it uses the difference of the same period as the current year, so only from January to September and that then leads to the different result because my average includes, the entire past year.
So either we find a way to calculate the average price over the same period length, or there is a way to calculate the difference over the whole past year, but I think it would be more correct with matching period. But either way is fine with me. Do you have a solution for this?

How about this formula?

 

DEF = [Average PP]-CALCULATE([Average PP], PREVIOUSYEAR('Calendar'[Date]))

Thank you so much. I see there is so much for me to learn so that hopefully in the future I will despair more of the challenging theme.

Yes I made a calendar table, I had it before. But I don't even get that far in the input, because I can't even enter the Measure Average PP into the formula. The formula only allows tables but no measures.

Helpful resources

Announcements
Europe Fabric Conference

Europe’s largest Microsoft Fabric Community Conference

Join the community in Stockholm for expert Microsoft Fabric learning including a very exciting keynote from Arun Ulag, Corporate Vice President, Azure Data.

RTI Forums Carousel3

New forum boards available in Real-Time Intelligence.

Ask questions in Eventhouse and KQL, Eventstream, and Reflex.

MayPowerBICarousel1

Power BI Monthly Update - May 2024

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