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
HishamAT
Helper I
Helper I

Diffrance between 2 values at different years.

Hi

  • Let's say that I have a field called NHC = 7.6 at year 2022 on the month of December 
  • Same field at year 2019 was 10.4 at the month of December 
  • I need to calculate the difference between the same fields for the same month in the years 2022 and 2019

Thanks

1 ACCEPTED SOLUTION

Hi @HishamAT ,

I can only think of a simpler way. The first is to directly modify the numbers in the formula. Another way is to use slicers.

Measure = -SELECTEDVALUE('Table'[Column1])
Measure 2 = EDATE ( MAX ( 'Table 2'[Date] ), [Measure] )

EDATE function (DAX) - DAX | Microsoft Learn

 

vpollymsft_0-1671585570070.pngvpollymsft_1-1671585579966.png

 

If it does not help, please provide more details with your desired output and pbix file without privacy information (or some sample data) .

 

Best Regards
Community Support Team _ Polly

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

View solution in original post

6 REPLIES 6
FreemanZ
Super User
Super User

hi @HishamAT 

seems not very doable. could you also provide some sample data and how you would like to present the result?

- NHC = 7.6  at year 2022 on the month of December 

- NHC = 10.4 at year 2019 on the month of December 

  • I need to calculate the difference between the same fields for the same month in the years 2022 and 2019

 

 

Hi @HishamAT ,

Please have a try.

Create a measure.

measure =
VAR _year =
    EDATE ( MAX ( 'Table 2'[Date] ), -36 )
VAR _value =
    CALCULATE (
        MAX ( 'TABLE'[NHC COLUMN NAME] ),
        FILTER ( ALL ( TABLE ), 'TABLE'[DATE] = SELECTEDVALUE ( 'TABLE'[DATE] ) )
    )
RETURN
    MAX ( 'TABLE'[NHC COLUMN NAME] ) - _value

 

If it does not help, please provide more details with your desired output and pbix file without privacy information (or some sample data) .

 

Best Regards
Community Support Team _ Polly

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

 

Great Sir, is that any way to make the 36 a dynamic date such 1 ,2, 3 .... etc ( As requested by the user ) .

Hi @HishamAT ,

I can only think of a simpler way. The first is to directly modify the numbers in the formula. Another way is to use slicers.

Measure = -SELECTEDVALUE('Table'[Column1])
Measure 2 = EDATE ( MAX ( 'Table 2'[Date] ), [Measure] )

EDATE function (DAX) - DAX | Microsoft Learn

 

vpollymsft_0-1671585570070.pngvpollymsft_1-1671585579966.png

 

If it does not help, please provide more details with your desired output and pbix file without privacy information (or some sample data) .

 

Best Regards
Community Support Team _ Polly

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

Thanks for your support , It works fine.

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.

Top Solution Authors