Forum Discussion
SAMEPERIODLASTYEAR bringing back current values
This has happened after working on
Solved: Re: KPIs visuals Running incredibly slowly - Microsoft Fabric Community
I have some DAX that is basically doing a distinct count on the person ID
And that gives me my total people
I have a date dimension connected by Date Key to Snapshot date key in the fact table. And have another DAX
Hii DebbieE
Try this for the above senario,No Pupils Same Period Last Year = CALCULATE ( SUM(Total People),SAMEPERIODLASTYEAR('Dim Date'[Date].[Date]))Did I answer your question?
Mark my post as a solution, this will help others...!
Hit the kudo also,
Thank you
ply try this
m1 = VAR _LastYear = MAX('Dim Date'[Year]) -1 RETURN CALCULATE ( SUMX ( VALUES ( 'Dim Person'[Person ID] ), 1 ), 'Dim Date'[Year] = _LastYear )
4 Replies
- DebbieECommunity Champion
Yep I had done the DAX slightly wrong and resolved it by the above. Thank you
- VallirajapResolver III
Hii DebbieE
Try this for the above senario,No Pupils Same Period Last Year = CALCULATE ( SUM(Total People),SAMEPERIODLASTYEAR('Dim Date'[Date].[Date]))Did I answer your question?
Mark my post as a solution, this will help others...!
Hit the kudo also,
Thank you
- DebbieECommunity Champion
I already have this and while it works to get back to the same period last year. It doesnt get me back to the last snapshot
- AhmedxSuper User
ply try this
m1 = VAR _LastYear = MAX('Dim Date'[Year]) -1 RETURN CALCULATE ( SUMX ( VALUES ( 'Dim Person'[Person ID] ), 1 ), 'Dim Date'[Year] = _LastYear )