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
Olwin
Frequent Visitor

Inventory Beginning and Ending Balance

Hi there,

 

I want to create a measure that shows Beginning Balance and Ending Balance of my Inventory.

I have 2 tables: Master Item and Inventory Transaction.

Here are my sample data:

 

Master Item

Item No.
A
B
C

 

Inventory Transaction

DateItemAmount
1-Jan-2021A  1,200,000.00
1-Feb-2021A      (60,000.00)
1-Mar-2021B     300,000.00
1-Apr-2021B      (10,000.00)
1-May-2021C     500,000.00
1-Jun-2021A       20,000.00
1-Jul-2021B       30,000.00
1-Aug-2021C      (15,000.00)
1-Sep-2021A       24,000.00
1-Oct-2021B        (5,800.00)
1-Nov-2021B       30,000.00
1-Dec-2021C18,000.00

 

I also have slicer to filter my Date.

My expected output is like below table: (Date Filter = 01-Mar-2021 to 30-Nov-2021)

ItemBeg BalanceEnding Balance
A1,140,000.001,184,000.00
B0344,200.00
C0485,000.00

 

Kindly please advise, how can I achive this.

Thank you.

6 REPLIES 6
Olwin
Frequent Visitor

Hi @selimovd ,

 

I got this result using your DAX formula. 

Support BegBalPic.jpg

 

 

 

 

 

 

I think we need to total the amount for "Beg Balance" is < "First Date Filter" and "End Bal" is <= "End Date Filter

I also attach my pbix file.

Thank you.

 

"https://smesolution-my.sharepoint.com/:u:/g/personal/olwin_smesolution_onmicrosoft_com/EU-gqB28B2lNn... 

Hey @Olwin ,

 

in this case you have to change the posting date to equal the exact minimum date, like this:

BegBal =
VAR first_date = [FirstDateVisible]
RETURN
    CALCULATE(
        SUM( VE[Cost Amount] ),
        VE[Posting Date] = first_date
    )

 

Also you have to make sure your the relationship between the Dates and the fact table has to be 1:n with single filter direction:

selimovd_0-1634565692782.png

 

Then it should work like you want.

 

If you need any help please let me know.
If I answered your question I would be happy if you could mark my post as a solution ✔️ and give it a thumbs up 👍
 
Best regards
Denis
 

Hi @selimovd ,

 

I still unable to get my expected result.

My founding is I need to create 1 more date table and not to relate it in any table, just to get the "Start Date" and "End Date" for all records with the same value on my date slicer.

Please find below link to find my revised pbix file.

I add new measure FirstDateVisibleNEW and LastDateVisibleNEW which refer to my new Date table. (You can see that this 2 measure is the same value as my date slicer).

 

Kindly please advise if there is any other solution to achive this 🙂

Thank you.

 

https://smesolution-my.sharepoint.com/:u:/g/personal/olwin_smesolution_onmicrosoft_com/EYZh623QdylBl... 

Hey @Olwin ,

 

what exactly is not working?

You don't need a second date table that is not connected to any other tables. As I mentioned in the last reply, you have to set the filter direction between date table and VE table to "single". Then the report is working properly.

 

If you need any help please let me know.
If I answered your question I would be happy if you could mark my post as a solution ✔️ and give it a thumbs up 👍
 
Best regards
Denis
 

Hi @selimovd ,

 

The result is not the same as my initial expectation.

Herewith I send you my .pbix file. I have followed your guidance to set filter direction to "single". Kindly please take a look.
Sample pbix file 

Thank you.

 

Best regards,

Olwin

selimovd
Super User
Super User

Hey @Olwin ,

 

that's possible with DAX measures:

Beg. Balance =
CALCULATE(
    SUM( 'Inventory Transaction'[Amount] ),
    'Inventory Transaction'[Date] = MIN( 'Inventory Transaction'[Date] )
)

 

And for the end balence:

End Balance =
CALCULATE(
    SUM( 'Inventory Transaction'[Amount] ),
    'Inventory Transaction'[Date] = MAX( 'Inventory Transaction'[Date] )
)

 

Be aware that you need a proper date table for the filtering to work. Here is a small tutorial how to create a date table:
 
If you need any help please let me know.
If I answered your question I would be happy if you could mark my post as a solution ✔️ and give it a thumbs up 👍
 
Best regards
Denis
 

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.