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
NickM12
New Member

Variation between Calculated measure in matrix

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

 

NickM12_0-1715776611229.png

 

1 ACCEPTED 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.

View solution in original post

8 REPLIES 8
NickM12
New Member

Thanks again,

 

AccManData[Period]="P4 YTD"

returns blank column, however if I change to

 

AccManData[Period]="P7"
then it looks correct, just need to get the P4 YTD, then i can subtract one from another.
 
I have checked the spelling etc, and seems ok, dont know why it doesn't like the P4 YTD?
 

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.

miTutorials
Super User
Super User

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)

hackcrr
Solution Sage
Solution Sage

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

 

NickM12_1-1715938580155.png

 

 

Helpful resources

Announcements
Europe Fabric Conference

Europe’s largest Microsoft Fabric Community Conference

Join the community in Stockholm for expert Microsoft Fabric learning including a very exciting keynote from Arun Ulag, Corporate Vice President, Azure Data.

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.