cancel
Showing results for
Did you mean:

Find everything you need to get certified on Fabric—skills challenges, live sessions, exam prep, role guidance, and more. Get started

Frequent Visitor

Share Valuation using FIFO method

Hello - I am trying to implement FIFO in share valuation. I was able to get it in excel, but not able to get the calculation in Power BI.

I am including the sample data (input and output) as was done in excel - gdrive link (https://drive.google.com/open?id=1vsc8R5MnGy2MVmqxUI7wgHssl6K6wjgM). The blue header columns in FINAL RESULT are the required output - I need help in creating these columns in Power BI - (a) CAPITAL GAIN (b) STOCK IN HAND © CLOSING VALUE

Also is the link for the PBX file (https://drive.google.com/open?id=1irJ2vOyV50WdVyYU45YQwA12rkqUNojm), where I am not able to fix the Calculated Column - “Cost Basis with FIFO”. Below is the DAX calculation for FIFO method that I am using - which is not working as per FIFO as it is not picking RATE (the multiplication factor) of the BUY QTY - rather it is picking the current row (SALE RATE), which is not the expected behavior of FIFO.

Cost Basis with FIFO =
VAR myUnits=[Qty.]
FILTER(TransactionData,
[IsIn]=EARLIER([IsIn])&&
[Sauda Date]<EARLIER([Sauda Date])&&
([Net Qty.] > 0)
)
VAR PreviousSales=
SUMX(
FILTER(TransactionData,
[IsIn]=EARLIER([IsIn])&&
[Sauda Date]<EARLIER([Sauda Date])&&
([Net Qty.] < 0)
),
[Qty.]
)
“Cumulative”,
SUMX(
([Sauda Date]<=EARLIER([Sauda Date]))
),
[Qty.])
),
“Balance Left”,
[Qty.]-IF([Cumulative]<PreviousSales,
[Qty.],
VAR PreviousCumulative=[Cumulative]-[Qty.]
RETURN
IF(PreviousSales>PreviousCumulative,PreviousSales-PreviousCumulative)
)
)
VAR CostUsed=
(
(
“MyCumulatives”,
SUMX
(
([Sauda Date]<=EARLIER([Sauda Date]))
),
[Balance Left])
),“Balance Used”,
IF(
[MyCumulatives]<myUnits,[MyCumulatives],
VAR PreviousCumulatives=[MyCumulatives]-[Balance Left]
RETURN
IF(myUnits>PreviousCumulatives,myUnits-PreviousCumulatives)
)
)
RETURN
IF([Net Qty.] < 0,
([Qty.][Rate])-SUMX(CostUsed,([Balance Used][Rate])))

0 REPLIES 0

Announcements

Europe’s largest Microsoft Fabric Community Conference

Join the community in Stockholm for expert Microsoft Fabric learning including a very exciting keynote from Arun Ulag, Corporate Vice President, Azure Data.

Power BI Monthly Update - June 2024

Check out the June 2024 Power BI update to learn about new features.

New forum boards available in Real-Time Intelligence.

Ask questions in Eventhouse and KQL, Eventstream, and Reflex.

Top Solution Authors
Top Kudoed Authors