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

Calling all Data Engineers! Fabric Data Engineer (Exam DP-700) live sessions are back! Starting October 16th. Sign up.

Reply
Anonymous
Not applicable

Help with SamePeriodLast Year

I need help crafting this formula to throw the right UP and Down arrow based if the current # of Unique Customers is greater than the # of Unique Customers last year in any given same period (based off the calendar date)

 

Here is the formula that I need to work:

# of Unique Customers KPI = IF([# of Unique Customers] > [# of Unique Customers Calendar SPLY], [# of Unique Customers]&" "&"▲", IF([# of Unique Customers] < [# of Unique Customers Calendar SPLY], [# of Unique Customers]&" "&"▼", [# of Unique Customers]&" "&"-"))
 
So for # of Unique Customers = DISTINCTCOUNT(Customer[Customer ID] 
 
and for # of Unique Customers Calendar SPLYCALCULATE([# of Total Unique Customers], SAMEPERIODLASTYEAR('Order Date'[Calendar Date]))

 

 

With all that fun stuff said I get a nasty error message saying "same period last year expects a contigous selection when the date column is not unique. It sees to break on the # of Unique Customers Calendar SPLY.  SPLY stands for SAME PERIOD LAST YEAR. 

 

1 ACCEPTED SOLUTION
v-frfei-msft
Community Support
Community Support

Hi @Anonymous ,

 

I think that should be the issue of your 'Order Date' table. Please create a CALENDAR table and create relationship between fact table and it. Then update your measure as below.

 

CALENDA= CALENDARAUTO()
 # of Unique Customers Calendar SPLY = CALCULATE([# of Total Unique Customers], SAMEPERIODLASTYEAR('CALENDAR'[Date]))
BTW, I created a sample for your reference.
 
# of Unique Customers = SUM('Sales (2)'[Customer Price Amount EUR])
# of Unique Customers Calendar SPLY = CALCULATE([# of Unique Customers],SAMEPERIODLASTYEAR('date'[Date]))
# of Unique Customers KPI = IF([# of Unique Customers] > [# of Unique Customers Calendar SPLY], [# of Unique Customers]&" "&"▲", IF([# of Unique Customers] < [# of Unique Customers Calendar SPLY], [# of Unique Customers]&" "&"▼", [# of Unique Customers]&" "&"-"))

Capture.PNG

 

Community Support Team _ Frank
If this post helps, then please consider Accept it as the solution to help the others find it more quickly.

View solution in original post

4 REPLIES 4
v-frfei-msft
Community Support
Community Support

Hi @Anonymous ,

 

I think that should be the issue of your 'Order Date' table. Please create a CALENDAR table and create relationship between fact table and it. Then update your measure as below.

 

CALENDA= CALENDARAUTO()
 # of Unique Customers Calendar SPLY = CALCULATE([# of Total Unique Customers], SAMEPERIODLASTYEAR('CALENDAR'[Date]))
BTW, I created a sample for your reference.
 
# of Unique Customers = SUM('Sales (2)'[Customer Price Amount EUR])
# of Unique Customers Calendar SPLY = CALCULATE([# of Unique Customers],SAMEPERIODLASTYEAR('date'[Date]))
# of Unique Customers KPI = IF([# of Unique Customers] > [# of Unique Customers Calendar SPLY], [# of Unique Customers]&" "&"▲", IF([# of Unique Customers] < [# of Unique Customers Calendar SPLY], [# of Unique Customers]&" "&"▼", [# of Unique Customers]&" "&"-"))

Capture.PNG

 

Community Support Team _ Frank
If this post helps, then please consider Accept it as the solution to help the others find it more quickly.
Ashish_Mathur
Super User
Super User

Hi,

There should ideally be a Calendar Table.  Build a relationship from the Calendar Date column  of the Order Date Table to the Date column of the Calendar Table.  To your visual, drag the Year/Month/Date or any other date dimension from the Calendar Table.  Write this measure

# of Unique Customers Calendar SPLYCALCULATE([# of Total Unique Customers], SAMEPERIODLASTYEAR('Calendar'[Date]))


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/
Sergiy
Resolver II
Resolver II

=UNICHAR(11205) for "▲" 

=UNICHAR(11206) for "▼"

Anonymous
Not applicable

It's not the unicode. The error is referncing some contigous date in the same period calculation.

Helpful resources

Announcements
FabCon Global Hackathon Carousel

FabCon Global Hackathon

Join the Fabric FabCon Global Hackathon—running virtually through Nov 3. Open to all skill levels. $10,000 in prizes!

September Power BI Update Carousel

Power BI Monthly Update - September 2025

Check out the September 2025 Power BI update to learn about new features.

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.

Top Solution Authors
Top Kudoed Authors