Microsoft Fabric Community Conference 2025, March 31 - April 2, Las Vegas, Nevada. Use code FABINSIDER for a $400 discount.
Register nowThe Power BI DataViz World Championships are on! With four chances to enter, you could win a spot in the LIVE Grand Finale in Las Vegas. Show off your skills.
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.
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)
Solved! Go to Solution.
Hi @swarajyadav24 ,
Perhaps you could try the EDATE function:
EDATE function (DAX) - DAX | Microsoft Learn
Best regards,
Community Support Team_ Scott Chang
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
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.
March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!
Check out the February 2025 Power BI update to learn about new features.
User | Count |
---|---|
85 | |
74 | |
63 | |
39 | |
38 |