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

To celebrate FabCon Vienna, we are offering 50% off select exams. Ends October 3rd. Request your discount now.

Reply
RuchiSharma
Frequent Visitor

Need to multiply from Previous row result to another column value.

Minimum product : Min(Data[Index])

Min Prod Value=

Data[Base]*CALCULATE((Data[Qty]),FILTER(Data,Data[Index]=MIN(Data[Index])))

"quantity (-) minimum prod value for ex: (10.0*02=0.2)

Need to consider the output of this previous row result (*) qty Ex: (0.2*0.03=0.006)

Formula: 10*0.02=0.2
0.2*0.03=0.006
0.006*0.04=0.00024
0.00024*0.05=0.000012

RuchiSharma_0-1688554622151.png

 

1 ACCEPTED SOLUTION
Anonymous
Not applicable

Hi @RuchiSharma ,

 

I suggest you to try code as below to create a calculated column.

Output =
VAR _MinProdValue =
    Data[Base]
        * CALCULATE (
            SUM ( Data[Qty] ),
            FILTER ( Data, Data[Index] = MIN ( Data[Index] ) )
        )
RETURN
    IF (
        Data[Index] = MIN ( Data[Index] ),
        _MinProdValue,
        CALCULATE (
            PRODUCT ( Data[Qty] ),
            FILTER ( Data, Data[Index] <= EARLIER ( Data[Index] ) )
        ) * Data[Base]
    )

Result is as below.

vrzhoumsft_0-1688698130377.png

 

Best Regards,
Rico Zhou

 

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

3 REPLIES 3
Anonymous
Not applicable

Hi @RuchiSharma ,

 

I suggest you to try code as below to create a calculated column.

Output =
VAR _MinProdValue =
    Data[Base]
        * CALCULATE (
            SUM ( Data[Qty] ),
            FILTER ( Data, Data[Index] = MIN ( Data[Index] ) )
        )
RETURN
    IF (
        Data[Index] = MIN ( Data[Index] ),
        _MinProdValue,
        CALCULATE (
            PRODUCT ( Data[Qty] ),
            FILTER ( Data, Data[Index] <= EARLIER ( Data[Index] ) )
        ) * Data[Base]
    )

Result is as below.

vrzhoumsft_0-1688698130377.png

 

Best Regards,
Rico Zhou

 

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Hello @Anonymous  -  What if Index is a date (I think it should work similar since it gives it order) AND also a column with different products (product A, B, C) and this is needed at a per product basis? how would you modify your code to accomodate? 

Thank you so much for spending time on the solution @Anonymous it's working fine.❤😊

Helpful resources

Announcements
September Power BI Update Carousel

Power BI Monthly Update - September 2025

Check out the September 2025 Power BI update to learn about new features.

Top Solution Authors
Top Kudoed Authors