Power BI is turning 10! Tune in for a special live episode on July 24 with behind-the-scenes stories, product evolution highlights, and a sneak peek at what’s in store for the future.
Save the dateEnhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.
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
Solved! Go to Solution.
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.
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.
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.
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.❤😊
User | Count |
---|---|
78 | |
74 | |
41 | |
31 | |
28 |
User | Count |
---|---|
100 | |
93 | |
52 | |
50 | |
48 |