Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Grow your Fabric skills and prepare for the DP-600 certification exam by completing the latest Microsoft Fabric challenge.

Reply
jesse_gorter
Frequent Visitor

same period last year problem with custom periods

Hi,

 

I have a snapshot table with student population with rows for students attending per the first of each month.

My report should show the daily totals except for the population. This needs to be the population of the first of october this studyyear (runs from 1 september till 31 august in the date dimension). I got that to work with: Populatie per 1 oktober:=CALCULATE(sum('Inschrijvingen stand'[Aantal]), Datum[Maandnummer] = 10, Datum[Dagnummer van maand] = 1, ALLEXCEPT(datum, Datum[Studiejaar]))  this works because even if the page has a filter: today= true, I get to keep the studyyear from todays date 🙂

 

But the target should be the population of the studyyear before. For some reason my sameperiod last year isn't working:

Norm populatie per 1 oktober:= CALCULATE([Populatie per 1 oktober], SAMEPERIODLASTYEAR(Datum[Datum]), all(datum)) shows all the first of octobers. same if i do the same allexcept on studiejaar as in the previous measure. How do I get this to work?

 

 

5 REPLIES 5
SivaMani
Resident Rockstar
Resident Rockstar

@jesse_gorter,

 

The year is mandatory for SAMEPERIODLASTYEAR function. Please do have a look at the below link for more details,

https://msdn.microsoft.com/en-us/query-bi/dax/sameperiodlastyear-function-dax

 

Thanks for your reply, but I don't quite understand.

In what way is it mandatory?

 

=CALCULATE(SUM(ResellerSales_USD[SalesAmount_USD]), SAMEPERIODLASTYEAR(DateTime[DateKey]))  

 

is similar to my usage isn't it?

 

 

no one?

Could you please post sample data along with the expected result?

that's going to be difficult as it is a SSAS cube...

 

Helpful resources

Announcements
RTI Forums Carousel3

New forum boards available in Real-Time Intelligence.

Ask questions in Eventhouse and KQL, Eventstream, and Reflex.

MayPowerBICarousel

Power BI Monthly Update - May 2024

Check out the May 2024 Power BI update to learn about new features.