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

Earn a 50% discount on the DP-600 certification exam by completing the Fabric 30 Days to Learn It challenge.

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

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). 

 

 

Hi @swarajyadav24 ,

 

Perhaps you could try the EDATE function:

EDATE function (DAX) - DAX | Microsoft Learn

 

Best regards,
Community Support Team_ Scott Chang

v-tianyich-msft
Community Support
Community Support

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
LearnSurvey

Fabric certifications survey

Certification feedback opportunity for the community.

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.