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

Calculate inventory per month

Hello, I want to calculate the inventory per month.

I have 3 tables: 

1)Warehouses master data (ID /State /City)

 

WarehouseIDSTATECITY
CHIST000030CHIHUAHUACHIHUAHUA
BCIST000011BAJA CALIFORNIA NORTEENSENADA
ASIST000016AGUASCALIENTESAGUASCALIENTES

 

2)Warehouse with Qty per material purchases (IN) and consumption (OUT)

 

WarehouseIDDateItemIDPURCHASECONSUMPTION
CHIST00003005-ene-23ABC1                    10                      1
CHIST00003031-ene-23ABC2                    15                      3
CHIST00003031-ene-23ABC1                    20                      3
CHIST00003001-feb-23ABC2                    30                      3
BCIST00001101-feb-23ABC1                    15                      4
BCIST00001101-feb-23ABC2                    -                        3
BCIST00001101-feb-23ABC1                    10                      3
CHIST00003001-feb-23ABC2                    -                        3
ASIST00001628-feb-23ABC1                      9                      3
ASIST00001628-feb-23ABC2                    28                      5
BCIST00001101-mar-23ABC1                    -                        2
CHIST00003006-mar-23ABC2                      5                      3
ASIST00001606-mar-23ABC1                    12                    -  
ASIST00001606-mar-23ABC2                    12                    15
CHIST00003006-mar-23ABC1                    32                    -  
CHIST00003006-mar-23ABC2                    90                    -  
CHIST00003006-mar-23ABC1                    -                        3
CHIST00003006-mar-23ABC2                      3                    -  
CHIST00003006-mar-23ABC1                    -                        3
CHIST00003006-mar-23ABC2                    20                      3
CHIST00003030-mar-23ABC1                    -                      15
CHIST00003030-mar-23ABC2                    -                        3

 

3)Dates.

 

Date
01-ene-23
02-ene-23
03-ene-23
04-ene-23
05-ene-23
06-ene-23
07-ene-23
08-ene-23
09-ene-23
10-ene-23
11-ene-23
31-dic-23

 

Here's the desired result:

CGarciaV_1-1690241069577.png

 

Thank You!!

1 REPLY 1
amitchandak
Super User
Super User

@CGarciaV , You need to use running total with help from date table joined to date of your table

 

 CALCULATE(SUM(Table[PURCHASE]),filter(date,date[date] <=maxx(date,date[date]))) - CALCULATE(SUM(Table[CONSUMPTION]),filter(date,date[date] <=maxx(date,date[date])))

 

Power BI Inventory On Hand: https://youtu.be/nKbJ9Cpb-Aw

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.