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

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.

Reply
kilala
Resolver I
Resolver I

Why SPLY doesnt work when I filter?

Hello all,

I wonder why my SPLY doesnt work when user select one month. For example, when user select March, I want to see the actual amount vs last year amount (march). but the value showed is blank. I am so confused.

 

Here is my SPLY measure = 

Amount SPLY =
CALCULATE([Actual Amount, SAMEPERIODLASTYEAR(vw_DimDate[Date]))
 
hope can find a way to solve this. thankssss
1 ACCEPTED SOLUTION
kilala
Resolver I
Resolver I

It's okay all, maybe there is error with my measure. I changed to this and it works:

Selected Parameter Value Actual SPLY =
var lastdateAvailable=CALCULATE(MAX(vw_FactSales[Date]),ALL(vw_FactSales)
var lastyearsameday=lastdateAvailable-365
var ifLY=IF(DAY(lastyearsameday)<>DAY(lastdateAvailable),TRUE(),FALSE())
var lastyearsamedayLY=IF(ifLY,lastdateAvailable-366,lastyearsameday)
var SPLYUntillastdate=FILTER(
SAMEPERIODLASTYEAR(vw_DimDate[Date].[Date]),
vw_DimDate[Date].[Date]<=lastyearsamedayLY)
return
CALCULATE(
[Actual Amount],
SPLYUntillastdate)

View solution in original post

2 REPLIES 2
kilala
Resolver I
Resolver I

It's okay all, maybe there is error with my measure. I changed to this and it works:

Selected Parameter Value Actual SPLY =
var lastdateAvailable=CALCULATE(MAX(vw_FactSales[Date]),ALL(vw_FactSales)
var lastyearsameday=lastdateAvailable-365
var ifLY=IF(DAY(lastyearsameday)<>DAY(lastdateAvailable),TRUE(),FALSE())
var lastyearsamedayLY=IF(ifLY,lastdateAvailable-366,lastyearsameday)
var SPLYUntillastdate=FILTER(
SAMEPERIODLASTYEAR(vw_DimDate[Date].[Date]),
vw_DimDate[Date].[Date]<=lastyearsamedayLY)
return
CALCULATE(
[Actual Amount],
SPLYUntillastdate)
amitchandak
Super User
Super User

@kilala , Make sure date table is marked and date table and and date table has all required joins

 

this measure should work, assuming [Actual Amount] is a measure

Amount SPLY =
CALCULATE([Actual Amount], SAMEPERIODLASTYEAR(vw_DimDate[Date]))

 

Why Time Intelligence Fails - Powerbi 5 Savior Steps for TI :https://youtu.be/OBf0rjpp5Hw
https://amitchandak.medium.com/power-bi-5-key-points-to-make-time-intelligence-successful-bd52912a5b...

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

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

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.