Showing results for 
Search instead for 
Did you mean: 
Helper I
Helper I

Custom Bin on Measure

Hello Power BI forums,

I've read a few solutions about this but can't seem to get this correct. I'm trying to create a custom bin based on a measure (see file attached). This is for a trading stock situation, where you have an entry then can have multiple exits (selling part of the position). The measure I created creates a weighted profit (i.e. one number) for per each entry. I want a histogram of the weighted profits by predefined bins (e.g. 0-5, 5-10%, etc).


I removed my attempts so you don't see the clutter, but I was trying:
-If statement is >min && <=Max
-I read a solution that used the Countrows then filter to the bins, there must be something off in my filter formulas, I keep messing with it.


My existing File:


The one table I have that shows "Profit weight by trade", there could be another solution to restructure the measure. Thanks for the help in advance, it's a race to the solution! 

Community Support
Community Support

Re: Custom Bin on Measure

Hi @Power_BI_Help ,


Sorry i don't quite understand what you want, can you show some details?

Community Support Team _ Jay
If this post helps, then please consider Accept it as the solution to help the other members find it.
Helper I
Helper I

Re: Custom Bin on Measure

Below is an excel replicate of the table that I am trying to output based on the given input tables. I was able to calculate the weight profit if I am able to use the axis as trade ID, but then I am unable to bin them appropriately. I think I need a formula that "creates" the weighted profit X trade ID table in the background and then counts between the min and max of the "bin" table. I'm just struggling to create that in a DAX.

Helpful resources


August Community Highlights

Check out a full recap of the month!

August 2020 CYST Challenge

Check out the winners of the recent 'Can You Solve These?' community challenge!

Experience what’s next for Power BI

Join us for an in-depth look at the new Power BI features and capabilities at the free Microsoft Business Applications Launch Event.

Top Solution Authors
Top Kudoed Authors