SOLVED

Subrental Supply Analysis to Purchase

%3CLINGO-SUB%20id%3D%22lingo-sub-2650903%22%20slang%3D%22en-US%22%3ESubrental%20Supply%20Analysis%20to%20Purchase%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-2650903%22%20slang%3D%22en-US%22%3E%3CP%3EHi%20everyone%2C%20I%20am%20trying%20to%20automate%20and%20create%20meaningful%20analyses%20of%20Subrental%20PO%20data%20for%20my%20company.%20We%20are%20a%20Film%20Production%20Equipment%20Rental%20Company%20that%20often%20has%20to%20subrent%20equipment%20from%20other%20Companies%20to%20fulfill%20the%20needs%20of%20our%20clients%2C%20and%20to%20figure%20out%20how%20much%20of%20each%20rental%20equipment%20product%20we%20would%20have%20needed%20to%20purchase%20to%20increase%20our%20inventory%20supply%20to%20meet%20those%20demands%20I%20started%20creating%20this%20spreadsheet.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EHowever%20I%20am%20only%20able%20to%20compare%20Rental%20Products%20one%20at%20a%20time%20in%20this%20spreadsheet%2C%20whereas%20I'd%20like%20to%20be%20able%20to%20convert%20the%20MAX%20values%20of%20all%20the%20Products%20into%20a%20pivot%20table%20broken%20up%20by%20monthly%20MAXs%20to%20see%20trends.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EThe%20basic%20way%20it%20works%20is%20I%20have%20a%20date%20sequence%20above%20the%20table%20for%2031%20days%20as%20an%20example%20(ideally%20I%20could%20have%20data%20for%20a%20longer%20range%20than%20this)%20and%20I%20use%20a%20SUMIF%20formula%20referencing%20each%20date%20column%20to%20count%20the%20quantities%20of%20subrentals%20for%20each%20day%20of%20a%20certain%20subrental%20product.%20Then%20I%20find%20the%20MAX%20of%20that%20set%20for%20the%20month.%20But%20this%20only%20works%20right%20now%20for%20a%20certain%20specified%20Rental%20Product%2C%20and%20I'd%20like%20to%20find%20a%20better%20way%20to%20automate%20this.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EI've%20attached%20the%20spreadsheet%20and%20I'd%20love%20to%20hear%20your%20thoughts%20or%20ideas%20on%20automating%20and%20making%20this%20spreadsheet%20more%20efficient!%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-LABS%20id%3D%22lingo-labs-2650903%22%20slang%3D%22en-US%22%3E%3CLINGO-LABEL%3EExcel%3C%2FLINGO-LABEL%3E%3CLINGO-LABEL%3EFormulas%20and%20Functions%3C%2FLINGO-LABEL%3E%3C%2FLINGO-LABS%3E%3CLINGO-SUB%20id%3D%22lingo-sub-2654103%22%20slang%3D%22en-US%22%3ERe%3A%20Subrental%20Supply%20Analysis%20to%20Purchase%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-2654103%22%20slang%3D%22en-US%22%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F562214%22%20target%3D%22_blank%22%3E%40mkloker%3C%2FA%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EIt%20could%20be%20done%20with%20PivotTable%20using%20data%20model.%3C%2FP%3E%0A%3CP%3E-%20creating%20PivotTable%20add%20your%20data%20to%20data%20model%3B%3C%2FP%3E%0A%3CP%3E-%20in%20Power%20Pivot%20create%20Date%20table%3C%2FP%3E%0A%3CP%3E(above%20is%20straightforward%20way%2C%20in%20general%20above%20better%20to%20do%20with%20Power%20Query)%3C%2FP%3E%0A%3CP%3E-%20create%20relationships%20on%20data%20for%20above%20two%20tables%3C%2FP%3E%0A%3CP%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20image-alt%3D%22image.png%22%20style%3D%22width%3A%20551px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F303599iC6A8085904BE9AB0%2Fimage-size%2Flarge%3Fv%3Dv2%26amp%3Bpx%3D999%22%20role%3D%22button%22%20title%3D%22image.png%22%20alt%3D%22image.png%22%20%2F%3E%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%3E-%20add%20DAX%20measures%3C%2FP%3E%0A%3CPRE%20class%3D%22lia-code-sample%20language-excel-formula%22%3E%3CCODE%3EQty%20Out%3A%3DVAR%20endDate%20%3D%0A%20%20%20%20MAX%20(%20'Calendar'%5BDate%5D%20)%0ARETURN%0A%20%20%20%20CALCULATE%20(%0A%20%20%20%20%20%20%20%20SUM%20(%20Table1%5BQty%5D%20)%2C%0A%20%20%20%20%20%20%20%20ALL%20(%20'Calendar'%5BDate%5D%20)%2C%0A%20%20%20%20%20%20%20%20Table1%5BDate_Out%5D%20%26lt%3B%3D%20endDate%2C%0A%20%20%20%20%20%20%20%20USERELATIONSHIP%20(%20'Calendar'%5BDate%5D%2C%20Table1%5BDate_Out%5D%20)%0A%20%20%20%20)%3C%2FCODE%3E%3C%2FPRE%3E%0A%3CP%3E%26nbsp%3Band%3C%2FP%3E%0A%3CPRE%20class%3D%22lia-code-sample%20language-excel-formula%22%3E%3CCODE%3EQty%20In%3A%3DVAR%20endDate%20%3D%0A%20%20%20%20MAX%20(%20'Calendar'%5BDate%5D%20)%0ARETURN%0A%20%20%20%20CALCULATE%20(%0A%20%20%20%20%20%20%20%20SUM%20(%20Table1%5BQty%5D%20)%2C%0A%20%20%20%20%20%20%20%20ALL%20(%20'Calendar'%5BDate%5D%20)%2C%0A%20%20%20%20%20%20%20%20'Calendar'%5BDate%5D%20%26lt%3B%20endDate%2C%0A%20%20%20%20%20%20%20%20USERELATIONSHIP%20(%20'Calendar'%5BDate%5D%2C%20Table1%5BDate_In%5D%20)%0A%20%20%20%20)%3C%2FCODE%3E%3C%2FPRE%3E%0A%3CP%3Ewith%20them%3C%2FP%3E%0A%3CPRE%20class%3D%22lia-code-sample%20language-excel-formula%22%3E%3CCODE%3EQty%20Diff%3A%3D%5BQty%20Out%5D%20-%20%5BQty%20In%5D%3C%2FCODE%3E%3C%2FPRE%3E%0A%3CP%3E%26nbsp%3Bgives%20Qty%20Out%20for%20each%20date%20(more%20exactly%20for%20the%20end%20of%20each%20period)%3C%2FP%3E%0A%3CP%3EFinally%3C%2FP%3E%0A%3CPRE%20class%3D%22lia-code-sample%20language-excel-formula%22%3E%3CCODE%3EMax%20in%20Period%3A%3DMAXX%20(%0A%20%20%20%20VALUES%20(%20'Calendar'%5BDate%5D%20)%2C%0A%20%20%20%20%5BQty%20Diff%5D%0A)%3C%2FCODE%3E%3C%2FPRE%3E%0A%3CP%3Egives%20max%20Qty%20Out%20in%20the%20period.%3C%2FP%3E%0A%3CP%3EPivotTable%20could%20be%20as%3C%2FP%3E%0A%3CP%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20image-alt%3D%22image.png%22%20style%3D%22width%3A%20516px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F303607i0E4A771B585C4605%2Fimage-size%2Flarge%3Fv%3Dv2%26amp%3Bpx%3D999%22%20role%3D%22button%22%20title%3D%22image.png%22%20alt%3D%22image.png%22%20%2F%3E%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%3EPlease%20check%20in%20attached.%3C%2FP%3E%3C%2FLINGO-BODY%3E
New Contributor

Hi everyone, I am trying to automate and create meaningful analyses of Subrental PO data for my company. We are a Film Production Equipment Rental Company that often has to subrent equipment from other Companies to fulfill the needs of our clients, and to figure out how much of each rental equipment product we would have needed to purchase to increase our inventory supply to meet those demands I started creating this spreadsheet.

 

However I am only able to compare Rental Products one at a time in this spreadsheet, whereas I'd like to be able to convert the MAX values of all the Products into a pivot table broken up by monthly MAXs to see trends.

 

The basic way it works is I have a date sequence above the table for 31 days as an example (ideally I could have data for a longer range than this) and I use a SUMIF formula referencing each date column to count the quantities of subrentals for each day of a certain subrental product. Then I find the MAX of that set for the month. But this only works right now for a certain specified Rental Product, and I'd like to find a better way to automate this.

 

I've attached the spreadsheet and I'd love to hear your thoughts or ideas on automating and making this spreadsheet more efficient!

 

1 Reply
best response confirmed by mkloker (New Contributor)
Solution

@mkloker 

It could be done with PivotTable using data model.

- creating PivotTable add your data to data model;

- in Power Pivot create Date table

(above is straightforward way, in general above better to do with Power Query)

- create relationships on data for above two tables

image.png

- add DAX measures

Qty Out:=VAR endDate =
    MAX ( 'Calendar'[Date] )
RETURN
    CALCULATE (
        SUM ( Table1[Qty] ),
        ALL ( 'Calendar'[Date] ),
        Table1[Date_Out] <= endDate,
        USERELATIONSHIP ( 'Calendar'[Date], Table1[Date_Out] )
    )

 and

Qty In:=VAR endDate =
    MAX ( 'Calendar'[Date] )
RETURN
    CALCULATE (
        SUM ( Table1[Qty] ),
        ALL ( 'Calendar'[Date] ),
        'Calendar'[Date] < endDate,
        USERELATIONSHIP ( 'Calendar'[Date], Table1[Date_In] )
    )

with them

Qty Diff:=[Qty Out] - [Qty In]

 gives Qty Out for each date (more exactly for the end of each period)

Finally

Max in Period:=MAXX (
    VALUES ( 'Calendar'[Date] ),
    [Qty Diff]
)

gives max Qty Out in the period.

PivotTable could be as

image.png

Please check in attached.