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
Syndicate_Admin
Administrator
Administrator

Calculated Column Value According to The Type of Movement

Good morning community, I have the following problem, I have this data:

CODEGUYDATEQTYWITH
5269II20/5/202250 5,00
5269COMP21/5/2022100 5,20
5269VTA22/5/202280 -
5269COMP23/5/202280 5,60
5269AJE24/5/20225 -
5269VTA25/5/20228 -
5269VTA26/5/202215 -

The Column "Code" represents an item of the warehouse,

The "Type" column is classified ("II" = Initial Inventory, "COMP" = Purchases, "VTA" = Sales", "AJE" = Adjustments)

Every time there are Types "II" and "COMP" the stock is increased (Suman), When there are "Types "VTA" and "AJE" there are stock reductions (Subtract).

It turns out that I must calculate the total value that each operation has, however when there is one of Type "II" or "COMP" it is simply multiply the Column "QTY" * "CU", now, when arriving at the Type "VTA" or "AJE" this must be the Average Value of the previous operations.

Currently I have other columns that calculate the "Accumulated QTY" by "Code" and the "Total Value" which is to multiply "QTY" * "CU".

CODEGUYDATEQTYWITHQTY ACUMULADATOTAL VALUE
5269II20/5/202250 5,0050 250,00
5269COMP21/5/2022100 5,20150 520,00
5269VTA22/5/202280 - 70 -
5269COMP23/5/202280 5,60150 448,00
5269AJE24/5/20225 - 145 -
5269VTA25/5/20228 - 137 -
5269VTA26/5/202215 - 122 -

The problem arises when calculating the "CU" of the "VTA" and "AJE" Types since these must be the average CU of the previous operations; which must be calculated "Total Value" / "Accumulated QTY", and generates an average that is saved and accumulated, however the system throws me that there is a "Circular Dependency" for it.

Ideally, the result should be as follows:

CODE

GUYDATEQTYWITHQTY ACUMULADATOTAL VALUEWITH PROMTOTAL
5269II20/5/202250 5,0050 250,00 5,0 250,0
5269COMP21/5/2022100 5,20150 520,00 5,1 770,0
5269VTA22/5/202280 - 70 - 5,1 359,3
5269COMP23/5/202280 5,60150 448,00 5,4 807,3
5269AJE24/5/20225 - 145 - 5,4 780,4
5269VTA25/5/20228 - 137 - 5,4 737,4
5269VTA26/5/202215 - 122 - 5,4 656,6

What I want to validate is whether you can have a table with calculated columns that determine the value of the average inventory per transaction according to the different Imputs that are included.

I hope you can help me and grateful with any support.

Best regards!

4 REPLIES 4
CarlosAugusto
Frequent Visitor

Estimado, te adjunto un ejemplo en Excel, de lo que mas o menos se requiere, de esta forma es mas comodo visualizar lo que necesito.

 

Saludos y agradecido por el apoyo.

 

CarlosAugusto_1-1654528296785.png

 

CarlosAugusto
Frequent Visitor

Estimado, adjunto ejemplo completo del calculo que se requiere.

 

CODIGOTIPOFECHAQTYCUMOVCU PROMTOTAL OPMOV ACUMCU PROMTOTAL ACUM
5269II20-05-202250,05,050               5,00           250,0050               5,00           250,00
5269COMP21-05-2022100,05,2100               5,20           520,00150               5,13           770,00
5269VTA22-05-202280,0                    -  -80               5,13         -410,6770               5,13           359,33
5269COMP23-05-202280,05,680               5,60           448,00150               5,38           807,33
5269AJE24-05-20225,0                    -  -5               5,38           -26,91145               5,38           780,42
5269VTA25-05-20228,0                    -  -8               5,38           -43,06137               5,38           737,36
5269VTA26-05-202215,0                    -  -15               5,38           -80,73122               5,38

           656,63

 

La idea es que cada vez que se genere un Tipo "COMP" ó "II" el calcule el valor promedio del inventario, mientra en el tipo "VTA" o "AJE" el tome el valor promedio de la fila anterior.

 

Agradecido por cualquier apoyo suministrado.

 

Saludos!

 

Adjunto ejemplo en excel.

 

CarlosAugusto_0-1653677996842.png

 

v-stephen-msft
Community Support
Community Support

Hi @CarlosAugusto ,

 

Currently I can only do the following.

vstephenmsft_1-1653552293233.png

I have a few questions for you.

vstephenmsft_0-1653552276174.png

How are 5.0, 5.1 and 5.4 in the penultimate column calculated?

Why is the last column 2500 instead of 25000, is it divided by 10?

How is 3593 calculated? From your description, it seems to be about the average.

 

Best Regards,

Stephen Tao

 

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

 

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.