Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
nmyre
Helper III
Helper III

New Calculated Column dividing column A by max of column B from 2 groups.

Hello,

I am trying to make a new column that finds the percent between column A and the MAX of column B all within groups. What essentially is happening is that I am taking each location, called "OBAN", and dividing their total sales for each month by the MAX of their total sales goal, titled FYTD Avail Total Auth". All within the fiscal year. There are two tables. Table A has the amounts to be divided and a "period" column that has a relationship with my date table. Here is table A.

 

Help 1.jpg

The dark blue lines divide the groups. They are based off the first column titled "OBAN". The second column, highlighted in light blue, has the relationship with the date table. The green highlighted column, titled “FYTD GrOB” has the number that need to be divided by the 6th columns MAX, highlighted in red.

 

Next is the date table. The light blue shows the relationship with the first table. The red "FY" Column is the other group. See Below:

Help 2.jpg

So For each Fiscal Year, "FY" I am looking for the percentage of sales to the maximum goal at the end of they Fiscal Year for each Location. The desired output column is in yellow below:

Desired Output.jpg

End goal is to make a timeline graph of % Sales.

 

Thank you!

 

1 ACCEPTED SOLUTION
Fowmy
Super User
Super User

@nmyre 

 

Add this code as a new column to your table 1, Rename Table1 to your correct table name.

% Diff = 

DIVIDE(
    Table1[FYTD GrOb],
    CALCULATE(
        MAX(Table1[FYTD Avail Total Auth]),
        ALLEXCEPT(Table1, Table1[OBAN])
    )
)


 

________________________

If my answer was helpful, please consider Accept it as the solution to help the other members find it

Click on the Thumbs-Up icon if you like this reply 🙂

YouTube  LinkedIn

Did I answer your question? Mark my post as a solution! and hit thumbs up


Subscribe and learn Power BI from these videos

Website LinkedIn PBI User Group

View solution in original post

3 REPLIES 3
Fowmy
Super User
Super User

@nmyre 

 

Add this code as a new column to your table 1, Rename Table1 to your correct table name.

% Diff = 

DIVIDE(
    Table1[FYTD GrOb],
    CALCULATE(
        MAX(Table1[FYTD Avail Total Auth]),
        ALLEXCEPT(Table1, Table1[OBAN])
    )
)


 

________________________

If my answer was helpful, please consider Accept it as the solution to help the other members find it

Click on the Thumbs-Up icon if you like this reply 🙂

YouTube  LinkedIn

Did I answer your question? Mark my post as a solution! and hit thumbs up


Subscribe and learn Power BI from these videos

Website LinkedIn PBI User Group

@Fowmy 

This is very close. Thank you. However, the data set has multiple years so the result is the FYTD GrOb differenece of MAX of all years. I added a Fiscal Year (FY) column, so that should make it easier. It looks like this:

Help again.jpg

I tried

% Diff = 

DIVIDE(
    Table1[FYTD GrOb],
    CALCULATE(
        MAX(Table1[FYTD Avail Total Auth]),
        ALLEXCEPT(Table1, Table1[OBAN]),
        ALLEXCEPT(Table1, Table1[FY])
    )
)

But it is off. Thoughts?

Hi , @nmyre 

Not  very clear.

Maybe you just need the formual as below:

% Diff =
DIVIDE (
    Table1[FYTD GrOb],
    CALCULATE (
        MAX ( Table1[FYTD Avail Total Auth] ),
        ALLEXCEPT ( Table1, Table1[OBAN], Table1[FY] )
    )
)

Best Regards,
Community Support Team _ Eason

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.