Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Earn a 50% discount on the DP-600 certification exam by completing the Fabric 30 Days to Learn It challenge.

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
RTI Forums Carousel3

New forum boards available in Real-Time Intelligence.

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

MayPowerBICarousel

Power BI Monthly Update - May 2024

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

LearnSurvey

Fabric certifications survey

Certification feedback opportunity for the community.