Forum Discussion

wiser's avatar
wiser
Frequent Visitor
4 years ago
Solved

DAX Measure For Calculating Stocking Levels

Hi all. I am trying to create a DAX formula/measure that calculates necessary stocking levels based on several different inputs.  The biggest input is the install base.  Even though it is a very ugl...
  • Barthel's avatar
    4 years ago

    Hey,

     

    I created your table in Excel in Power BI. Above it slicers for the parameters. You can use the following code to calculate 'Tier 1':

    Tier 1 = 
    VAR _ProposedCS =
        SELECTEDVALUE ( ProposedCS[ProposedCS] )
    VAR _PropesedLT =
        SELECTEDVALUE ( ProposedLT[ProposedLT] )
    VAR _AnnualUsage =
        SELECTEDVALUE ( 'Table'[Annual Usage] )
    VAR _TT =
        SELECTEDVALUE ( 'Table'[TTQ] )
    RETURN
        IF (
            _ProposedCS * _AnnualUsage > 5,
            VAR _m1 =
                MAXX (
                    {
                        _TT + _TT - 1,
                        ROUNDUP ( DIVIDE ( _ProposedCS * _AnnualUsage, 12 ), 0 )
                    },
                    [Value]
                )
            VAR _m2 =
                ROUNDUP ( DIVIDE ( _ProposedCS * _AnnualUsage, 365 ) * _PropesedLT, 0 )
            RETURN
                _m1 + _m2,
            0
        )

    You can use the above code as a basis for calculating the other calculations. Adjust the parameters and conditions for this. Hope this helps.