Find everything you need to get certified on Fabric—skills challenges, live sessions, exam prep, role guidance, and more.
Get startedGrow your Fabric skills and prepare for the DP-600 certification exam by completing the latest Microsoft Fabric challenge.
Hi, I was doing some calculations, and in this one I use a filter to select the max date :
date = MAX(Date[Dates]),
Now I need te value from the same date but in the last year, I have tried with
date = SAMEPERIODLASTYEAR (MAX(Date[dates]))
But it gives me an error with dates
Is there a way to solve this or I need to develop another solution
Solved! Go to Solution.
you can try 'lydate = MAX(Date[Dates])-365' or you can try the DATEADD function
I have the same problem and cannot get it to work.
Sameperiodlast year does not work. OpenCurrentYTD is correct
OpenCurrentYTD =
Var Segmentvar = AllSELECTED(WorkersComp[Segment])
Var Divisionvar = AllSELECTED(WorkersComp[Sub-Segment])
Return
CALCULATE(Count(WorkersComp[Solvinjury ID]),WorkersComp[Segment] in Segmentvar,WorkersComp[Sub-Segment]in Divisionvar,
Filter(ALL(WorkersComp),( WorkersComp[InclusiveStatus]="Yes" && WorkersComp[DateSubmittedME] <= max('Calendar'[Date]) && WorkersComp[DateSubmittedME] <> Blank() && (('WorkersComp'[ClosedME] = Blank()) || WorkersComp[ClosedME] > max('Calendar'[Date]) ))))
Tried
PrevPeriod =
Var Segmentvar = AllSELECTED(WorkersComp[Segment])
Var Divisionvar = AllSELECTED(WorkersComp[Sub-Segment])
Var PrevPMax = EOMONTH(DATE(YEAR(TODAY()),MONTH(TODAY())-1,DAY(TODAY())),-12)
Return
CALCULATE(Count(WorkersComp[Solvinjury ID]),WorkersComp[Segment] in Segmentvar,WorkersComp[Sub-Segment]in Divisionvar,
Filter(ALL(WorkersComp),(WorkersComp[InclusiveStatus]="Yes" && WorkersComp[DateSubmittedME] <=PrevPMax && WorkersComp[DateSubmittedME] <> Blank() && (('WorkersComp'[ClosedME] = Blank()) || WorkersComp[ClosedME] >PrevPMax))))
And Tried
KeepFilters =
Var Segmentvar = AllSELECTED(WorkersComp[Segment])
Var Divisionvar = AllSELECTED(WorkersComp[Sub-Segment])
Var PrevPMax = EOMONTH(DATE(YEAR(TODAY()),MONTH(TODAY())-1,DAY(TODAY())),-12)
Return
CALCULATE(Count(WorkersComp[Solvinjury ID]),WorkersComp[Segment] in Segmentvar,WorkersComp[Sub-Segment]in Divisionvar,
Keepfilters(WorkersComp),(WorkersComp[InclusiveStatus]="Yes" && WorkersComp[DateSubmittedME] <=PrevPMax && WorkersComp[DateSubmittedME] <> Blank() && (('WorkersComp'[ClosedME] = Blank()) || WorkersComp[ClosedME] >PrevPMax)))
Results:
Any ideas?
you can try 'lydate = MAX(Date[Dates])-365' or you can try the DATEADD function
This is not valid syntax - you seem to be mixing inbuilt time intelligence with custom time intelligence. It seems you have a calendar table. The date from the calendar table needs to be in your visual. Then you could write this
=calculate([measure],sameperiodlastyear(date[date]))
read my article here https://exceleratorbi.com.au/dax-time-intelligence-beginners/
User | Count |
---|---|
77 | |
77 | |
68 | |
67 | |
49 |
User | Count |
---|---|
108 | |
104 | |
93 | |
83 | |
64 |