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

Earn the coveted Fabric Analytics Engineer certification. 100% off your exam for a limited time only!

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
April AMA free

Microsoft Fabric AMA Livestream

Join us Tuesday, April 09, 9:00 – 10:00 AM PST for a live, expert-led Q&A session on all things Microsoft Fabric!

March Fabric Community Update

Fabric Community Update - March 2024

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