Forum Discussion

gardas_swathi's avatar
gardas_swathi
Icon for Microsoft Employee rankMicrosoft Employee
6 years ago

Calculate Beginning Quarter Value

I need to calculate beginning inventory based on the quarter selection

 

CalendarDateFiscalQuarterDescFiscalYearNbrFiscalMonthNameCalendarYear
7/1/2019FY20-Q1FY20FY20-Jul2019
8/1/2019FY20-Q1FY20FY20-Aug2019
9/1/2019FY20-Q1FY20FY20-Sep2019
10/1/2019FY20-Q2FY20FY20-Oct2019
11/1/2019FY20-Q2FY20FY20-Nov2019
12/1/2019FY20-Q2FY20FY20-Dec2019
1/1/2020FY20-Q3FY20FY20-Jan2020
2/1/2020FY20-Q3FY20FY20-Feb2020
3/1/2020FY20-Q3FY20FY20-Mar2020
4/1/2020FY20-Q4FY20FY20-Apr2020
5/1/2020FY20-Q4FY20FY20-May2020
6/1/2020FY20-Q4FY20FY20-Jun2020

 

ValueDateProductID
30007/1/20191
40007/1/20192
20008/1/20191
10009/1/20191
500010/1/20191
400011/1/20191
20012/1/20191
90001/1/20201
50002/1/20201
6003/1/20201
45004/1/20201
25005/1/20201
3006/1/20201

 

If the Users Chooses Q1 with no filter on product , Beginning Inventory for Q1 should be 7000

Beginning inventory when user filters on Fiscal quarter Q2 , it should change to 5000.

 

How do i acheive this through DAX ?

 

Thanks in Advance

1 Reply

  • Anonymous's avatar
    Anonymous
    Not applicable

    first load both table in power Bi.

     

    Create below calciulated column

    First_month_of_Quarter = CALCULATE(MIN(Sheet5[CalendarDate]),ALLEXCEPT(Sheet5,Sheet5[FiscalQuarterDesc]))

     

    Ten go to relationship tab and create relatiomn on First_month_of_Quarter to second date table.(Many to many)

     

    Create measure

    Starting_Inventory = SUM(Sheet4[Value])
     
    and finally drag this measure and date column in table it will show expect result.
     
     
    Thanks & regards,
    Pravin Wattamwar
    www.linkedin.com/in/pravin-p-wattamwar

    If I resolve your problem Mark it as a solution and give kudos.