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.
Hello everyone, I am trying to calculate R12 for past 5 years. I am filtering my data based on Date lookup table. The max or latest date is 01/07/2021(dd/mm/yyyy). When I choose this latest date(July) from slicer I was expecting to see 01/08/2020. However calculation returned just blank. However when I choose June calculation is correct. Is there anyone to help to solve the issue?
The Dax Code:
Solved! Go to Solution.
Hey @Anonymous ,
I'm not really sure if the approach makes sense as DATEADD just changes the dates in the column. I think what you are looking for is the function DATESINPERIOD. Try the following approach:
R12 IND =
VAR SelectedMaxDate = MAX( 'Date Lookup'[Date] )
VAR MinDate =
CALCULATE(
MIN( 'Date Lookup'[Date] ),
DATESINPERIOD(
'Date Lookup'[Date],
SelectedMaxDate,
-1,
YEAR
)
)
RETURN
MinDate
Hey @Anonymous ,
I'm not really sure if the approach makes sense as DATEADD just changes the dates in the column. I think what you are looking for is the function DATESINPERIOD. Try the following approach:
R12 IND =
VAR SelectedMaxDate = MAX( 'Date Lookup'[Date] )
VAR MinDate =
CALCULATE(
MIN( 'Date Lookup'[Date] ),
DATESINPERIOD(
'Date Lookup'[Date],
SelectedMaxDate,
-1,
YEAR
)
)
RETURN
MinDate
Hello Denis, thanks a lot for your solution! It worked 😊
Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City
Check out the April 2024 Power BI update to learn about new features.
User | Count |
---|---|
109 | |
99 | |
77 | |
66 | |
54 |
User | Count |
---|---|
144 | |
104 | |
102 | |
87 | |
64 |