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
Renu15
Regular Visitor

Days of supply question

 

I want to understand how do i calculate the days of supply as shown below in powerBI based on product and site. Can anyone suggest how i do it in powerbi as I have done in excel.

 

DSI of jan 2021= (SUM OF DAYS IN NEXT 3 MONTHS* Jan End Inv)/(sum of demand for next 3 months)

 
Product FamilySitesQuarterNo.of MonthMonth2021 On Hand Inv2021 DemandMonth-YearNo of dayssum of next month   demandsum of days in next 3 monthsDSI
ABCXYZQ11Jan73490.8406738851.33Jan-2021311243758952.5885616
ABCXYZQ12Feb71827.5073338863.33Feb-202128   `
ABCXYZQ13Mar71094.17441933.33Mar-202131   
ABCXYZQ24Apr67316.17443578Apr-202130   
ABCXYZQ25May62344.17444572May-202131   
ABCXYZQ26Jun56666.17445478Jun-202130   
ABCXYZQ37Jul52703.02543563.15Jul-202131   
ABCXYZQ38Aug50411.87643491.15Aug-202131   
ABCXYZQ39Sep40450.72741961.15Sep-202130   
ABCXYZQ410Oct41373.3500738077.38Oct-202131   
ABCXYZQ411Nov45791.9731435381.38Nov-202130   
ABCXYZQ412Dec53916.5962131475.38Dec-202131   
1 ACCEPTED SOLUTION
parry2k
Super User
Super User

@Renu15 hey you should add a date dimension in your model, you can add one from my blog post here, once it is done, add the following measure for DSI

 

DSI = 
VAR __DateTable3Months = DATESINPERIOD ( 'Calendar'[Date], EOMONTH ( MAX ( 'Calendar'[Date] ), 0 ) + 1, 3, MONTH ) 
VAR __DemandsNext3Months = 
CALCULATE ( 
    SUM ( [2021 Demand] ), 
    __DateTable3Months
)
VAR __DaysNext3Month = 
    CALCULATE (
        COUNTROWS ( 'Calendar' ),
        __DateTable3Months
    )
RETURN
    DIVIDE ( __DemandsNext3Months, __DaysNext3Month )

 

Check my latest blog post Compare Budgeted Scenarios vs. Actuals I would  Kudos if my solution helped. 👉 If you can spend time posting the question, you can also make efforts to give Kudos to whoever helped to solve your problem. It is a token of appreciation!

Visit us at https://perytus.com, your one-stop-shop for Power BI-related projects/training/consultancy.

 



Subscribe to the @PowerBIHowTo YT channel for an upcoming video on List and Record functions in Power Query!!

Learn Power BI and Fabric - subscribe to our YT channel - Click here: @PowerBIHowTo

If my solution proved useful, I'd be delighted to receive Kudos. When you put effort into asking a question, it's equally thoughtful to acknowledge and give Kudos to the individual who helped you solve the problem. It's a small gesture that shows appreciation and encouragement! ❤


Did I answer your question? Mark my post as a solution. Proud to be a Super User! Appreciate your Kudos 🙂
Feel free to email me with any of your BI needs.

View solution in original post

10 REPLIES 10
parry2k
Super User
Super User

@Renu15 How about 4:00 CST? Send me an email (my email is in my signature)



Subscribe to the @PowerBIHowTo YT channel for an upcoming video on List and Record functions in Power Query!!

Learn Power BI and Fabric - subscribe to our YT channel - Click here: @PowerBIHowTo

If my solution proved useful, I'd be delighted to receive Kudos. When you put effort into asking a question, it's equally thoughtful to acknowledge and give Kudos to the individual who helped you solve the problem. It's a small gesture that shows appreciation and encouragement! ❤


Did I answer your question? Mark my post as a solution. Proud to be a Super User! Appreciate your Kudos 🙂
Feel free to email me with any of your BI needs.

I have sent you the zoom link through my id. Please just check it in case you recieved or not !

parry2k
Super User
Super User

@Renu15 Hey sorry what is not working, are you ok to share your pbix file or we can do a team/zoom meeting and I can have a quick look.



Subscribe to the @PowerBIHowTo YT channel for an upcoming video on List and Record functions in Power Query!!

Learn Power BI and Fabric - subscribe to our YT channel - Click here: @PowerBIHowTo

If my solution proved useful, I'd be delighted to receive Kudos. When you put effort into asking a question, it's equally thoughtful to acknowledge and give Kudos to the individual who helped you solve the problem. It's a small gesture that shows appreciation and encouragement! ❤


Did I answer your question? Mark my post as a solution. Proud to be a Super User! Appreciate your Kudos 🙂
Feel free to email me with any of your BI needs.

Yes, we can have a zoom call. I am in USA time zone. I am unable to load the pbix file. At what time you are available ? I am available in between 3.30-4.00 P.m CST.

 

Please let me know and I can send the zoom link. It will be good to discuss the issue verbally as I need it very urgentl for my executives! Thanks alot !

Renu15
Regular Visitor

@amitchandakcan you please review this problem and suggest what I should. I used code [rovided by Parry but it is not working for me !

parry2k
Super User
Super User

@Renu15 seems like you don't have a date column in your model. change this code as below

 

Calendar=
VAR __dates = CALENDAR ( "2021,01,01", "2021,12,31" )
RETURN
ADDCOLUMNS (
    __dates,
    "Year",             YEAR ( [Date] ),
    "Month Number",     MONTH ( [Date] ),
    "Month Name",       FORMAT ( [Date], "MMMM" ), --use MMMM for full month name, January instead of Jan
    "Month",            FORMAT( [Date], "MMM, YYYY" ), --use MMMMM for full month name, January instead of Ja
    "Month Sort",       FORMAT( [Date], "YYYY-MM" ),
    "Quarter",          "Q" & FORMAT( [Date], "Q, YYYY" ),
    "Quarter Sort",     FORMAT ( [Date], "YYYY-Q" )
)

 

and make sure in your data table you have a date column that you can set the relationship on, between these two tables.

 

 



Subscribe to the @PowerBIHowTo YT channel for an upcoming video on List and Record functions in Power Query!!

Learn Power BI and Fabric - subscribe to our YT channel - Click here: @PowerBIHowTo

If my solution proved useful, I'd be delighted to receive Kudos. When you put effort into asking a question, it's equally thoughtful to acknowledge and give Kudos to the individual who helped you solve the problem. It's a small gesture that shows appreciation and encouragement! ❤


Did I answer your question? Mark my post as a solution. Proud to be a Super User! Appreciate your Kudos 🙂
Feel free to email me with any of your BI needs.

parry2k
Super User
Super User

@Renu15 hey you should add a date dimension in your model, you can add one from my blog post here, once it is done, add the following measure for DSI

 

DSI = 
VAR __DateTable3Months = DATESINPERIOD ( 'Calendar'[Date], EOMONTH ( MAX ( 'Calendar'[Date] ), 0 ) + 1, 3, MONTH ) 
VAR __DemandsNext3Months = 
CALCULATE ( 
    SUM ( [2021 Demand] ), 
    __DateTable3Months
)
VAR __DaysNext3Month = 
    CALCULATE (
        COUNTROWS ( 'Calendar' ),
        __DateTable3Months
    )
RETURN
    DIVIDE ( __DemandsNext3Months, __DaysNext3Month )

 

Check my latest blog post Compare Budgeted Scenarios vs. Actuals I would  Kudos if my solution helped. 👉 If you can spend time posting the question, you can also make efforts to give Kudos to whoever helped to solve your problem. It is a token of appreciation!

Visit us at https://perytus.com, your one-stop-shop for Power BI-related projects/training/consultancy.

 



Subscribe to the @PowerBIHowTo YT channel for an upcoming video on List and Record functions in Power Query!!

Learn Power BI and Fabric - subscribe to our YT channel - Click here: @PowerBIHowTo

If my solution proved useful, I'd be delighted to receive Kudos. When you put effort into asking a question, it's equally thoughtful to acknowledge and give Kudos to the individual who helped you solve the problem. It's a small gesture that shows appreciation and encouragement! ❤


Did I answer your question? Mark my post as a solution. Proud to be a Super User! Appreciate your Kudos 🙂
Feel free to email me with any of your BI needs.

@parry2kcan you please help me? I even added the date dimension and logic which you have given is not working.

I added a date dimesnion in my data and your code is not working.

Capture.JPG

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.