Find everything you need to get certified on Fabric—skills challenges, live sessions, exam prep, role guidance, and more.
Get startedGrow your Fabric skills and prepare for the DP-600 certification exam by completing the latest Microsoft Fabric challenge.
Hi, I think this should be simple if you know how! 😉
I have a matrix with a calculated measure (working out the GP% (Margin/Sales)).
I need to subtract one periods GP% from the other, to see the growth, but cannot find a way to do this, please could anyone help.
Many thanks
Solved! Go to Solution.
Hi, @NickM12
You can change DAX to look like this:
Previous GP% =
CALCULATE(
[GP%],
FILTER(
'AccManData',
'AccManData'[Period]= "P4 YTD"
)
)
Best Regards,
hackcrr
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Thanks again,
AccManData[Period]="P4 YTD"
returns blank column, however if I change to
Your solutions is great @hackcrr and @miTutorials
Hi, @NickM12
Have you solved your problem? If so, can you share your solution here or mark the correct answer as a standard answer to help other members find it faster. Thank you very much for your kind cooperation!
How to Get Your Question Answered Quickly
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
Jianpeng Li
HI, @NickM12
If your PERIOD is only P7 and P4 YTD then you can write it like this:
Previous GP% =
CALCULATE(
[GP%],
FILTER(
'AccManData',
'AccManData'[Period]<> "P7"
)
)
Best Regards,
hackcrr
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
You can also use Visual level calculation and perform calculations like you do in Excel. See the tutorial below.
🚀 NEW FEATURE : Magic of Visual Calculations in Power BI | MiTutorials (youtube.com)
Hi, @NickM12
To calculate the growth in GP% between two periods in the Power BI Matrix, you need to create a new metric to calculate the difference between the GP% of the current period and the GP% of the previous period. Assuming you have already calculated GP% (Gross Profit Percentage) as a metric, you can create a new metric to calculate the growth. You can do this:
Create a GP% metric: First, make sure you have a GP% metric. Here's an example if you don't already have one:
GP% = DIVIDE([Sum of TY Margin], [Sum of TY Sales])
Create a metric for GP% for the previous period: Next, create a metric to get the GP% for the previous period:
Previous GP% =
CALCULATE(
[GP%],
PREVIOUSMONTH('YourDateTable'[Date])
)
Make sure to replace 'YourDateTable'[Date] with the actual date column in the date table. Create Growth Metric: Now create a metric to calculate GP% growth:
GP% Growth =
[GP%] - [Previous GP%]
Make sure your date table is properly labeled as a date table in Power BI. The date column PREVIOUSMONTH used in the function should be continuous and have no gaps.
Adjust the date range functions (PREVIOUSMONTH, PREVIOUSDAY, etc.) based on the granularity of the data (monthly, daily, etc.).
Best Regards,
hackcrr
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Thanks for your response, I do not have a date table, as the periods are not specific dates, they are just 'P4 YTD' & P7. So I can't use the previous month feature.
Hi, @NickM12
You can change DAX to look like this:
Previous GP% =
CALCULATE(
[GP%],
FILTER(
'AccManData',
'AccManData'[Period]= "P4 YTD"
)
)
Best Regards,
hackcrr
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Thanks for your help. I got it to work by using the above & removing the 'Columns',
it would have been good to get in the first format, but I think using columns it is difficult
Join the community in Stockholm for expert Microsoft Fabric learning including a very exciting keynote from Arun Ulag, Corporate Vice President, Azure Data.
Ask questions in Eventhouse and KQL, Eventstream, and Reflex.
User | Count |
---|---|
85 | |
83 | |
66 | |
61 | |
58 |
User | Count |
---|---|
194 | |
111 | |
105 | |
79 | |
71 |