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

Don't miss out! 2025 Microsoft Fabric Community Conference, March 31 - April 2, Las Vegas, Nevada. Use code MSCUST for a $150 discount. Prices go up February 11th. Register now.

Reply
smko
Helper I
Helper I

Dynamic Stock balance according to PIC as at selected period

Greetings BI community, I came across an interesting business requirement where the report has to show the stock balance of Person In Charge (PIC) as at selected period. Each PIC will have a table report (hard code to specific PIC at visual filter) showing only stock balance of his brand.

 

InventoryMovement

DateBrandPICValue
2023-01-01XA1000
2023-02-01XA-100
2023-03-01XB500
2023-06-30XB-800
2023-01-01YA5000

 

Changelog of PIC and brand

BrandPICStartDateEndDate
XA2023-01-012023-02-28
XB2023-03-012023-12-31
YA2023-02-012023-06-30

 

For example:
- Selected date filter is Q1, report of PIC A should only show stock balance for Brand X as at 2023-02-28 and Brand Y as at 2023-03-31, report of PIC B show stock balance for Brand X as at 2023-03-31

- Selected date filter is Q2, report of PIC A should only show stock balance for Brand Y as at 2023-06-30, report of PIC B show stock balance for Brand X as at 2023-06-30

 

Desired result:

smko_0-1698222795325.png


With the below code Im unable to achieve the desired result as it only calculate the value between each PIC StartDate and EndDate. The current PIC value in InventoryMovement table is following the StartDate EndDate, maybe there is a better model for this?

 

Stock Balance = 
VAR _MaxDate = MAX('Calendar'[Date])
RETURN
CALCULATE(
    SUM(InventoryMovement[Value]),
    ALLSELECTED(PIC),
    'Calendar'[Date] <= _MaxDate
)

 


This link contains the pbix file: test.pbix

2 REPLIES 2
Anonymous
Not applicable

Hi @smko ,

I have some doubt.

Why is the X in PIC Part A of 2023 Q1 900, but the X in PIC Part B of 2023 Q1 is 1400? Why doesn't PIC B ignore the PIC distinction? I may have missed some details, please help.

 

 

How to Get Your Question Answered Quickly 

 

If it does not help, please provide more details with your desired output and pbix file without privacy information (or some sample data) .

 

Best Regards
Community Support Team _ Rongtie

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

 

 

 

 

Hi @Anonymous , the idea is to get stock balance up to the EndDate of the PIC. For Brand X in Q1, since EndDate of PIC A is 2023-02-28, the stock balance as at that date is only 900; while PIC B took over from 2023-03-01 onwards, at the end of Q1 the stock balance should have 1400.

Helpful resources

Announcements
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount! Prices go up Feb. 11th.

Jan25PBI_Carousel

Power BI Monthly Update - January 2025

Check out the January 2025 Power BI update to learn about new features in Reporting, Modeling, and Data Connectivity.

Jan NL Carousel

Fabric Community Update - January 2025

Find out what's new and trending in the Fabric community.