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

Be one of the first to start using Fabric Databases. View on-demand sessions with database experts and the Microsoft product team to learn just how easy it is to get started. Watch now

Reply
FrankS72
Regular Visitor

Calculated Column

I'm struggling to performa required calc, which I want to do in a new column.

 

Example Data:

Table: Monthly_Sales   
     
ConsultantMonthSalesBest Month% Best
AdamAug 19 $      1,500 $          1,80083%
AdamSep 19 $      1,200 $          1,80067%
AdamOct 19 $      1,800 $          1,800100%
AdamNov 19 $      1,250 $          1,80069%
MandySep 19 $      3,500 $          4,00088%
MandyOct 19 $      3,250 $          4,00081%
MandyNov 19 $      4,000 $          4,000100%
SueNov 19 $      1,150 $          1,150100%
GeorgeAug 19 $      1,500 $          1,70088%
GeorgeSep 19 $      1,600 $          1,70094%
GeorgeOct 19 $      1,700 $          1,700100%

 

I want to calculate the 'best month' for each consultant (as a new column), and then compare each month to the best month at a row level.

I'm struggling to perform the best month calculation, as Maxx(Filter(..)) is returning the best month across all consultants, rather than for each.

 

Help will be greatly appreciated - I'm pretty new to Power BI 🙂

1 ACCEPTED SOLUTION
Fowmy
Super User
Super User

@FrankS72 

 

Try This:

 Best NEW = 

VAR BEST = CALCULATE( MAX(SALES[Sales]),ALLEXCEPT(SALES,SALES[Consultant]))

RETURN

BEST

 

% vs BEST = 

DIVIDE(
    SALES[Sales],
    SALES[Best NEW]
)

 

________________________

Did I answer your question? Mark this post as a solution, this will help others!.

I accept KUDOS 🙂

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

5 REPLIES 5
v-yiruan-msft
Community Support
Community Support

Hi @FrankS72 ,

You can create calculated columns or measures to achieve it:

1. Create calculated columns

Best Month = CALCULATE(MAX('Monthly_Sales'[Sales]),FILTER('Monthly_Sales','Monthly_Sales'[Consultant]=EARLIER('Monthly_Sales'[Consultant])))
% Best = DIVIDE('Monthly_Sales'[Sales],'Monthly_Sales'[Best Month])

2. Create measures

Measure = CALCULATE(MAX('Monthly_Sales'[Sales]),FILTER(ALL('Monthly_Sales'),'Monthly_Sales'[Consultant]=MAX('Monthly_Sales'[Consultant])))
Measure 2 = DIVIDE(MAX('Monthly_Sales'[Sales]),[Measure])

Calculated Column.jpgBest Regards

Rena

 

 

 

 

Community Support Team _ Rena
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
amitchandak
Super User
Super User

@FrankS72 , try like

divide(sum(Table[sales]),calculate(max(Table[Sales]), allexcept(Table, Table[Consultant])))

 

Also, refer

https://community.powerbi.com/t5/Desktop/Percentage-of-subtotal/td-p/95390

Join us as experts from around the world come together to shape the future of data and AI!
At the Microsoft Analytics Community Conference, global leaders and influential voices are stepping up to share their knowledge and help you master the latest in Microsoft Fabric, Copilot, and Purview.
️ November 12th-14th, 2024
 Online Event
Register Here
andre
Memorable Member
Memorable Member

here is a tutorial on how to find best records (which is what you want) and calculate the average of best (which in your case i am not sure what you are trying to do)

 

 

you can download the practice materials here: https://businessintelligist.com/2020/07/24/tutorial-how-to-calculate-an-average-of-the-best-using-av...

Fowmy
Super User
Super User

@FrankS72 

 

Try This:

 Best NEW = 

VAR BEST = CALCULATE( MAX(SALES[Sales]),ALLEXCEPT(SALES,SALES[Consultant]))

RETURN

BEST

 

% vs BEST = 

DIVIDE(
    SALES[Sales],
    SALES[Best NEW]
)

 

________________________

Did I answer your question? Mark this post as a solution, this will help others!.

I accept KUDOS 🙂

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

Thank you - this worked well.

Helpful resources

Announcements
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!

Dec Fabric Community Survey

We want your feedback!

Your insights matter. That’s why we created a quick survey to learn about your experience finding answers to technical questions.

ArunFabCon

Microsoft Fabric Community Conference 2025

Arun Ulag shares exciting details about the Microsoft Fabric Conference 2025, which will be held in Las Vegas, NV.

December 2024

A Year in Review - December 2024

Find out what content was popular in the Fabric community during 2024.