March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount! Early bird discount ends December 31.
Register NowBe one of the first to start using Fabric Databases. View on-demand sessions with database experts and the Microsoft product team to learn just how easy it is to get started. Watch now
Hi Experts,
please help me to acheive the below:
I tried hard but nothing is working.
I want to subtract the value = Dec-Jan = -16.28
Please help me on this.
Regards.,
Swamy
Solved! Go to Solution.
Hi @Swamy3105 ,
Below is my table:
You can create a index column:
The following DAX might work for you:
output =
var _a = CALCULATE(max('table'[value]),filter('table','table'[index]=earlier('table'[index])+1))
RETURN
'Table'[Value] - _a
The final output is shown in the following figure:
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.
You could be use measure instead of calculated column. I believe measure is best option to summarize the expression and also good to performance. you will use below expression as seen in the snapshot.
Hi @Swamy3105 ,
Thank you for @Syndicate_Admin answer , and I have other suggestions:
Below is my table:
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:
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.
thanks for your dax, but I need to subtract the value from current month to previous month as below:
Regards.,
Swamy
Hi @Swamy3105 ,
Below is my table:
You can create a index column:
The following DAX might work for you:
output =
var _a = CALCULATE(max('table'[value]),filter('table','table'[index]=earlier('table'[index])+1))
RETURN
'Table'[Value] - _a
The final output is shown in the following figure:
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.
Nice
March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!
Arun Ulag shares exciting details about the Microsoft Fabric Conference 2025, which will be held in Las Vegas, NV.
User | Count |
---|---|
114 | |
76 | |
57 | |
52 | |
44 |
User | Count |
---|---|
167 | |
117 | |
63 | |
57 | |
50 |