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

Enhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.

Reply
swarajyadav24
New Member

Error while selecting alternate Quarters from Date slicer

I have Year, Month-Name, Date and Quarter-Name columns in Dim_Cal Table.

I have used below DAX to get the value of previous period
----------------------------------------

Sales-Previous-Year=
Var Current= CALCULATE(SUM(Fact_ETB[Sales]) )
Var P-Y= CALCULATE(SUM(Fact_ETB[Sales]), SAMEPERIODLASTYEAR(Dim_Cal[Date]) )
Var Result= Current-P-Y
return Result
----------------------------------------

Now, I have dragged Year, Quarter-Name and Month-Name under one slicer lets name it "Time"

I have taken a KPI and Dragged Sales-Previous-Year measure in it. It is showing values correctly when I select continoues
records under Time Slicer(like Q1 and Q2). However, When I select Q1 and Q4 under any same or any year. It is throwing me error. on the KPI Visual, when I click on the "see details" on the KPI Visual. it show's the below error.  

 

swarajyadav24_0-1711634105393.png

 

 

Now using Sales-Previous-Year measure provide me dax, such that even though I select alternate options in Time slicer.
the error should skip instead of getting error I should get some other text(like "The selected columns Not applicable" or 0) 

1 ACCEPTED SOLUTION
Anonymous
Not applicable

Hi @swarajyadav24 ,

 

Perhaps you could try the EDATE function:

EDATE function (DAX) - DAX | Microsoft Learn

 

Best regards,
Community Support Team_ Scott Chang

View solution in original post

3 REPLIES 3
swarajyadav24
New Member

Thank you for the quick response. 

Do we have any other DAX function, which will provide same result as SAMEPERIODLASTYEAR does, At the same time, it should also work, when we click (Q1 and Q3) or (Q2 and Q4). 

 

 

Anonymous
Not applicable

Hi @swarajyadav24 ,

 

Perhaps you could try the EDATE function:

EDATE function (DAX) - DAX | Microsoft Learn

 

Best regards,
Community Support Team_ Scott Chang

Anonymous
Not applicable

Hi @swarajyadav24 ,

 

When you use SAMEPERIODLASTYEAR, the date table needs to be continuous.

 

Hope it helps!

 

Best regards,
Community Support Team_ Scott Chang

 

If this post helps then please consider Accept it as the solution to help the other members find it more quickly.

Helpful resources

Announcements
July 2025 community update carousel

Fabric Community Update - July 2025

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

July PBI25 Carousel

Power BI Monthly Update - July 2025

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

Join our Fabric User Panel

Join our Fabric User Panel

This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.

Top Kudoed Authors