Forum Discussion
wiser
4 years agoFrequent Visitor
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...
- 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.
Barthel
4 years agoSolution Sage
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.
- wiser4 years agoFrequent Visitor
Thank you very much, I really appreciate this! Hope you have a good weekend.