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
Zkna-M
Frequent Visitor

running sum grouped by probablity

I am trying to add a new measure that can calulate cumulative total of value of an item and summarise it on based on probablity.

This is the data that I have

 

ItemValueProbablity
4640.9
4760.8
2420.0
1930.9
1840.8
2850.1
1990.2
1550.1
2911.0
2470.5
2710.7
3800.4

 

So if I summarise by probablity 0.8 and item 1, it should give me the sum of value for all probablity greater than 0.8

 

This is the report that I want to create.

Item 0.10.20.30.40.50.60.70.80.91
1331276177177177177177177930
2294209209209209162162919191
380808080000000
4140140140140140140140140640

 

Can anyone help me out.

1 ACCEPTED SOLUTION
Vvelarde
Community Champion
Community Champion

@Zkna-M

 

hi friend

 

First, Create a new Table (Modeling Enter Data)

 

ProbTable.png

 

2. Related Both Table 

 

3. Create a New Measure

 

SumValues =
CALCULATE (
    SUM ( Table1[Value] ),
    FILTER (
        ALLEXCEPT ( Table1; Table1[Item] ),
        Table1[Probablity] >= MAX ( Probabilities[Probability] )
    )
)
    + 0

4. Ready. You can view in a Matrix

 

Matrix.png




Lima - Peru

View solution in original post

4 REPLIES 4
Vvelarde
Community Champion
Community Champion

@Zkna-M

 

hi friend

 

First, Create a new Table (Modeling Enter Data)

 

ProbTable.png

 

2. Related Both Table 

 

3. Create a New Measure

 

SumValues =
CALCULATE (
    SUM ( Table1[Value] ),
    FILTER (
        ALLEXCEPT ( Table1; Table1[Item] ),
        Table1[Probablity] >= MAX ( Probabilities[Probability] )
    )
)
    + 0

4. Ready. You can view in a Matrix

 

Matrix.png




Lima - Peru

I tried but it is not working for me. I must be missing something. 

This is the measure that I have: 

 

SumValue = 
CALCULATE(
	SUM('Item'[Value]),
	FILTER( ALLEXCEPT('Item','Item'[Item]),
		'Item'[Probability] <= MAX(Probablities[Probability])
	)
)
+ 0

 

And this the matrix that I get: 

 

Matrix.JPGWhat am I missing? 

 

 

 

@Zkna-M

 

It should be "greater than" (>=) the custom porbability in filter context:

 

SumValue = 
CALCULATE(
	SUM('Item'[Value]),
	FILTER( ALLEXCEPT('Item','Item'[Item]),
		'Item'[Probability] >= MAX(Probablities[Probability])
	)
)
+ 0

Regards,

 

Sorry. my mistake. I tried changing the sign and doing again but it wasn't working. 

Then I created everything from the scratch again and now it is working. 

 

Thank you so much!

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.