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

Find everything you need to get certified on Fabric—skills challenges, live sessions, exam prep, role guidance, and more. Get started

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
Europe Fabric Conference

Europe’s largest Microsoft Fabric Community Conference

Join the community in Stockholm for expert Microsoft Fabric learning including a very exciting keynote from Arun Ulag, Corporate Vice President, Azure Data.

Power BI Carousel June 2024

Power BI Monthly Update - June 2024

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

RTI Forums Carousel3

New forum boards available in Real-Time Intelligence.

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