Join us at FabCon Atlanta from March 16 - 20, 2026, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.
Register now!To celebrate FabCon Vienna, we are offering 50% off select exams. Ends October 3rd. Request your discount now.
Hi,
I have a matrix table showing data for each month.
Can you please advise what is the formula to calculate difference between last month vs first month.
For example: 14-49 = -35
Thank you in advance!
Solved! Go to Solution.
Hi @wy_khoo ,
According to your description, here are my steps you can follow as a solution.
(1) This is my test data.
(2) We can create a measure.
Measure =
var _first_date=CALCULATE(MIN('Table'[date]),ALLSELECTED('Table'))
var _first_value=CALCULATE(SUM('Table'[value]),FILTER(ALLSELECTED('Table'),MONTH('Table'[date])=MONTH(_first_date) && YEAR('Table'[date])=YEAR(_first_date)))
var _value=CALCULATE(SUM('Table'[value]),FILTER(ALLSELECTED('Table'),YEAR('Table'[date])=YEAR(MAX('Table'[date])) && MONTH('Table'[date])=MONTH(MAX('Table'[date]))))
RETURN _value-_first_value
(3) Then the result is as follows.
If the above one can't help you get the desired result, please provide some sample data in your tables (exclude sensitive data) with Text format and your expected result with backend logic and special examples. It is better if you can share a simplified pbix file. Thank you.
Best Regards,
Neeko Tang
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Hi @wy_khoo ,
According to your description, here are my steps you can follow as a solution.
(1) This is my test data.
(2) We can create a measure.
Measure =
var _first_date=CALCULATE(MIN('Table'[date]),ALLSELECTED('Table'))
var _first_value=CALCULATE(SUM('Table'[value]),FILTER(ALLSELECTED('Table'),MONTH('Table'[date])=MONTH(_first_date) && YEAR('Table'[date])=YEAR(_first_date)))
var _value=CALCULATE(SUM('Table'[value]),FILTER(ALLSELECTED('Table'),YEAR('Table'[date])=YEAR(MAX('Table'[date])) && MONTH('Table'[date])=MONTH(MAX('Table'[date]))))
RETURN _value-_first_value
(3) Then the result is as follows.
If the above one can't help you get the desired result, please provide some sample data in your tables (exclude sensitive data) with Text format and your expected result with backend logic and special examples. It is better if you can share a simplified pbix file. Thank you.
Best Regards,
Neeko Tang
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Hi @Anonymous , thank you for your solution. It works!
Hi @wy_khoo
Please refer to the linked tutorial:
https://www.youtube.com/watch?v=cAxoxvnN_vQ
If this post helps, then please consider Accepting it as the solution to help the other members find it more quickly
User | Count |
---|---|
98 | |
78 | |
77 | |
49 | |
26 |