cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Power_BI_Help
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: 

https://www.dropbox.com/s/ydee6f7p788bk6e/Weighted%20Positions%20Custom%20Bins.pbix?dl=0

 

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! 

2 REPLIES 2
v-jayw-msft
Community Support
Community Support

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.

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.

https://imgur.com/a/NScZ7AW

Helpful resources

Announcements
PBI_User Group Leader_768x460.jpg

Manage your user group events

Check out the News & Announcements to learn more.

MBAS on Demand

2021 Release Wave 2 Plan

Power Platform release plan for the 2021 release wave 2 describes all new features releasing from October 2021 through March 2022.

Get Ready for Power BI Dev Camp

Microsoft named a Leader in The Forrester Wave

Microsoft received the highest score of any vendor in both the strategy and current offering categories.

R2 (Green) 768 x 460px.png

Microsoft Dynamics 365 & Power Platform User Professionals

DynamicsCon is a FREE, 4 half-day virtual learning experience for 11,000+ Microsoft Business Application users and professionals.

Top Solution Authors