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
Swamy3105
Helper IV
Helper IV

How to subtract the values between two months in the same column using calculated column

Hi Experts,

 

please help me to acheive the below:

 

I tried hard but nothing is working.

 

Swamy3105_0-1715886749206.png

I want to subtract the value  = Dec-Jan = -16.28

 

Please help me on this.

 

Regards.,

Swamy

3 REPLIES 3
v-xiandat-msft
Community Support
Community Support

Hi @Swamy3105 ,

Thank you for @Syndicate_Admin answer , and I have other suggestions:

Below is my table:

vxiandatmsft_0-1715914184602.png

The following DAX might work for you:

Column = 
 VAR _month = MIN('Table'[Year])
 VAR _new_month = MONTH(EDATE(_month,1))
 VAR _a = CALCULATE(MAX('Table'[FIFO]),FILTER('Table',MONTH('Table'[Year]) = _new_month))
 VAR _b = CALCULATE(MAX('Table'[FIFO]),FILTER('Table',MONTH('Table'[Year]) = MONTH(_month)))
 RETURN
 _b - _a

The final output is shown in the following figure:

vxiandatmsft_1-1715914216850.png

Best Regards,

Xianda Tang

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

Hi @Syndicate_Admin 

 

thanks for your dax, but I need to subtract the value from current month to previous month as below:

 

Swamy3105_0-1715923405115.png

 

Regards.,

Swamy

Syndicate_Admin
Administrator
Administrator

Nice

Helpful resources

Announcements
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.