Forum Discussion
Date Range From Input Parameters in Calculate DAX
- Anonymous3 years ago
Hi Anonymous ,
I have created a simple sample , please refer to my pbix file to see if it helps you.
Create 2 measures.
Previous Period(Measure) = VAR _1 = EDATE ( MAX ( 'Table'[Date] ), -12 ) VAR _2 = CALCULATE ( SUM ( 'Table'[Value] ), FILTER ( ALL ( 'Table' ), 'Table'[Date] = _1 ) ) VAR _3 = IF ( _2 = BLANK (), BLANK (), _2 + MAX ( 'Table'[Value] ) ) RETURN _3Measure = VAR _1 = EDATE ( MAX ( 'Table'[Date] ), 12 ) VAR _2 = SUMX ( FILTER ( ALL ( 'Table' ), 'Table'[Date] = _1 ), [Previous Period(Measure)] ) VAR _3 = _2 - [Previous Period(Measure)] RETURN IF ( _2 = BLANK () || [Previous Period(Measure)] = BLANK (), BLANK (), _3 )How to Get Your Question Answered Quickly
If it does not help, please provide more details with your desired output and pbix file without privacy information (or some sample data) .
Best Regards
Community Support Team _ RongtieIf this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Hi Anonymous ,
I have created a simple sample , please refer to my pbix file to see if it helps you.
Create 2 measures.
Previous Period(Measure) =
VAR _1 =
EDATE ( MAX ( 'Table'[Date] ), -12 )
VAR _2 =
CALCULATE (
SUM ( 'Table'[Value] ),
FILTER ( ALL ( 'Table' ), 'Table'[Date] = _1 )
)
VAR _3 =
IF ( _2 = BLANK (), BLANK (), _2 + MAX ( 'Table'[Value] ) )
RETURN
_3
Measure =
VAR _1 =
EDATE ( MAX ( 'Table'[Date] ), 12 )
VAR _2 =
SUMX (
FILTER ( ALL ( 'Table' ), 'Table'[Date] = _1 ),
[Previous Period(Measure)]
)
VAR _3 = _2 - [Previous Period(Measure)]
RETURN
IF ( _2 = BLANK () || [Previous Period(Measure)] = BLANK (), BLANK (), _3 )
How to Get Your Question Answered Quickly
If it does not help, please provide more details with your desired output and pbix file without privacy information (or some sample data) .
Best Regards
Community Support Team _ Rongtie
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.