Advance your Data & AI career with 50 days of live learning, dataviz contests, hands-on challenges, study groups & certifications and more!
Get registeredGet Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Learn more
Dear community,
I already tried several possibilities to sum up row by row based on the following table:
| quantity in kg Pt/Ru | unit (kg) | type | sorting | Index | actual stock | expected values | 
| 66,902103 | kg | local stock | 45386 | 0 | if local stock = using the number of column quantity in kg Pt/Ru | 66,902103 | 
| 50 | kg | order | 45836 | 1 | if order deduct column quantity in kg Pt/Ru from previous row of actual stock | 16,902103 | 
| 25 | kg | order | 45863 | 2 | if order deduct column quantity in kg Pt/Ru from previous row of actual stock | -8,097897 | 
| 25 | kg | order | 45863 | 3 | if order deduct column quantity in kg Pt/Ru from previous row of actual stock | -33,097897 | 
| 32,5 | kg | production order | 45887 | 4 | if production order add column quantity in kg Pt/Ru from previous row of actual stock | -0,597897 | 
| 32,5 | kg | production order | 45901 | 5 | if production order add column quantity in kg Pt/Ru from previous row of actual stock | 31,902103 | 
But no proposed formula delivered the expected values.
Is anybody able to help.
Thanks in advance.
Solved! Go to Solution.
Actual = 
CALCULATE(
    CALCULATE(
        SUM( STK[Quantity in kg Pt/Ru] ),
        STK[Type] IN { "local stock", "production order" }
    )
        - CALCULATE( SUM( STK[Quantity in kg Pt/Ru] ), STK[Type] = "order" ),
    STK[Index] <= EARLIER( STK[Index] ),
    REMOVEFILTERS()
)| Expertise = List.Accumulate( {Days as from Today}, {Skills and Knowledge}, (Current, Everyday) => Current & Day.LearnAndPractise(Everyday) ) | 
Actual = 
CALCULATE(
    CALCULATE(
        SUM( STK[Quantity in kg Pt/Ru] ),
        STK[Type] IN { "local stock", "production order" }
    )
        - CALCULATE( SUM( STK[Quantity in kg Pt/Ru] ), STK[Type] = "order" ),
    STK[Index] <= EARLIER( STK[Index] ),
    REMOVEFILTERS()
)| Expertise = List.Accumulate( {Days as from Today}, {Skills and Knowledge}, (Current, Everyday) => Current & Day.LearnAndPractise(Everyday) ) | 
Sorry to ask a stupid question, did you put in the DAX directly in the visual or in the table as new column?
Do I need to replace Table with the name of my existing table?
Here is one example
 
					
				
				
			
		
Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!
Check out the October 2025 Power BI update to learn about new features.
 
            | User | Count | 
|---|---|
| 9 | |
| 5 | |
| 4 | |
| 3 | |
| 3 | 
| User | Count | 
|---|---|
| 23 | |
| 14 | |
| 11 | |
| 10 | |
| 9 |