The ultimate Fabric, Power BI, SQL, and AI community-led learning event. Save €200 with code FABCOMM.
Get registeredCompete to become Power BI Data Viz World Champion! First round ends August 18th. Get started.
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 @Anonymous ,
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 @Anonymous ,
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 @Anonymous ,
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