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
LuisBassetti
New Member

Daily Position

Hello all

 

I need som help/idea to create a daily position like inventory. Starting from a beggining balance, I have all the entries ( production, purchases, returns) and also all my outputs (shipments, transfers) to get the final balance in the day, that will be used as beggining balance for the next day, thinking in a full month view.

 

Example:

 

How can I bring the final position of the last day (850) as a begginning balance of the day 02?

 Day 01Day02
Initial Position1000850
Production500470
Purchases10020
Shipments-600-580
Transfers-1500
Final Position850760

 

 

1 ACCEPTED SOLUTION

Hi @LuisBassetti,

 

Please check below sample if it suitable for your requirement.

 

1. Create a table with begin/end type of each records.

Analysis = 
CROSSJOIN (
    DISTINCT (
        SELECTCOLUMNS (
            Sheet1,
            "Code", [Code],
            "Date", [Date],
            "Item", [Item],
            "Local", [Local],
            "Month", [Month]
        )
    ),
    UNION ( ROW ( "Type", "a_Begin" ), ROW ( "Type", "z_End" ) )
)

2.PNG

 

 

2. Add QTY column to calculate the amount.

QTY = 
var temp= LOOKUPVALUE (Sheet2[Qty],Sheet2[Code], [Code], Sheet2[Date], DATE([Date].[Year],[Date].[MonthNo],1) )
RETURN
SWITCH (
        [Type],
        "a_Begin",temp
            + SUMX (
                FILTER (
                    ALL(Sheet1),
                    Sheet1[Code] = EARLIER ( [Code] )
                        && Sheet1[Date] < EARLIER ( [Date] )
                ),
                [QTY]
            ),
        "z_End", temp 
            + SUMX (
                FILTER (
                    ALL(Sheet1),
                    Sheet1[Code] = EARLIER ( [Code] )
                        && Sheet1[Date] <= EARLIER ( [Date] )
                ),
                [QTY]
            ),
        0
    ) 

3.PNG

 

 

3. Format analysis table and union original table.

Merged = UNION(Sheet1,SELECTCOLUMNS(Analysis,"Code",[Code],"Item",[Item],"Type",[Type],"I/O","","QTY",[Qty],"Local",[Local],"Date",[Date],"Month",[Month])) 

4.PNG

 

 

4. Use above table to create matrix visual.

1.PNG

 

Notice: I have shared the sample file as the attachment.

 

Regards,

Xiaoxin Sheng

Community Support Team _ Xiaoxin
If this post helps, please consider accept as solution to help other members find it more quickly.

View solution in original post

5 REPLIES 5
v-shex-msft
Community Support
Community Support

Hi @LuisBassetti,

 

If you can please share some sample file to test, it will be help for analysis.

 

Regards,

Xiaoxin Sheng

Community Support Team _ Xiaoxin
If this post helps, please consider accept as solution to help other members find it more quickly.

File attached on Google Drive: Table for inventory PBI

 

due to the character limit.

Hi @LuisBassetti,

 

Please check below sample if it suitable for your requirement.

 

1. Create a table with begin/end type of each records.

Analysis = 
CROSSJOIN (
    DISTINCT (
        SELECTCOLUMNS (
            Sheet1,
            "Code", [Code],
            "Date", [Date],
            "Item", [Item],
            "Local", [Local],
            "Month", [Month]
        )
    ),
    UNION ( ROW ( "Type", "a_Begin" ), ROW ( "Type", "z_End" ) )
)

2.PNG

 

 

2. Add QTY column to calculate the amount.

QTY = 
var temp= LOOKUPVALUE (Sheet2[Qty],Sheet2[Code], [Code], Sheet2[Date], DATE([Date].[Year],[Date].[MonthNo],1) )
RETURN
SWITCH (
        [Type],
        "a_Begin",temp
            + SUMX (
                FILTER (
                    ALL(Sheet1),
                    Sheet1[Code] = EARLIER ( [Code] )
                        && Sheet1[Date] < EARLIER ( [Date] )
                ),
                [QTY]
            ),
        "z_End", temp 
            + SUMX (
                FILTER (
                    ALL(Sheet1),
                    Sheet1[Code] = EARLIER ( [Code] )
                        && Sheet1[Date] <= EARLIER ( [Date] )
                ),
                [QTY]
            ),
        0
    ) 

3.PNG

 

 

3. Format analysis table and union original table.

Merged = UNION(Sheet1,SELECTCOLUMNS(Analysis,"Code",[Code],"Item",[Item],"Type",[Type],"I/O","","QTY",[Qty],"Local",[Local],"Date",[Date],"Month",[Month])) 

4.PNG

 

 

4. Use above table to create matrix visual.

1.PNG

 

Notice: I have shared the sample file as the attachment.

 

Regards,

Xiaoxin Sheng

Community Support Team _ Xiaoxin
If this post helps, please consider accept as solution to help other members find it more quickly.

That's exactly what I need! Thank you so much!!

Anonymous
Not applicable

The easiest way to achieve this would be to have tables set up that hold the information you care about that do particular tasks.  For example you might have:

  • a table of stock items, with a stock code and the initial stock position. 
  • a production table with dates, stock codes and quantities created.
  • a purchases table with dates, customer codes, stock codes, and quantities
  • a shipments table with dates, stock codes, and quantities
  • a transfers table with dates, stock codes and quantities
  • a date table
  • any other reference tables, such as customers etc

 

Now what you can do is create a measure that is:

Current Position = sum('Stock'[Initial Position') + sum('Production'[Quantity']) + sum('Purchases'[Quantity']) - sum('Production'[Shipments]) - sum('Production'[Transfers'])

Lastly, you can create a table visual with the Stock items as your rows and the Current Position as the values.  Using a Date Slicer, you can get your current stock by starting your filter at the first date and the date you are interested in.

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.

Top Solution Authors
Top Kudoed Authors