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

Get certified in Microsoft Fabric—for free! For a limited time, get a free DP-600 exam voucher to use by the end of 2024. Register now

Reply
AlexisPREVOT
Resolver I
Resolver I

Sameperiod Last Year - Display Issue

Hi the community,

 

Like many of you, I try to compare billing amounts from year to year.
I used the "sameperiodlastyear" function but even if the calculation looks good, the values ​​are not displayed in the associated column.

 

My formula : 

TotalPREC = CALCULATE(SUM(LIGNES_FACT[LFC_FACTURE_CONSOLIDEE]),SAMEPERIODLASTYEAR(FACTURES[FCC_DATE]))
 
And the visualization :
AlexisPREVOT_0-1617775389385.png

 

Can you please explain to me why this is not working ?

Thanks in advance

 

 Alexis
1 ACCEPTED SOLUTION
AlexisPREVOT
Resolver I
Resolver I

Hi,

Hello,

Thank you again for your answers.
By digging into the idea of ​​filtering, I found a solution on the Internet in 2 steps:
1 calculated column : LastYear = DATEADD(Calendar[Date];-1;year)

 

and 1 measure : CALCULATE(
SUM(LIGNES_FACT[LFC_FACTURE_CONSOLIDEE]);
FILTER(
All(Calendar);
CONTAINS(VALUES(Calendar[Last Year]);Calendar[Last Year];Calendar[Date])
)
)

 

 

View solution in original post

5 REPLIES 5
AlexisPREVOT
Resolver I
Resolver I

Hi,

Hello,

Thank you again for your answers.
By digging into the idea of ​​filtering, I found a solution on the Internet in 2 steps:
1 calculated column : LastYear = DATEADD(Calendar[Date];-1;year)

 

and 1 measure : CALCULATE(
SUM(LIGNES_FACT[LFC_FACTURE_CONSOLIDEE]);
FILTER(
All(Calendar);
CONTAINS(VALUES(Calendar[Last Year]);Calendar[Last Year];Calendar[Date])
)
)

 

 

AlexisPREVOT
Resolver I
Resolver I

Thank you for yours answers.

 

I do have a clean date table.
But unfortunately no solution works, I have the same result each time ...

Hi,

Thank you for your feedback.

If it is OK with you, please share your sample pbix file's link, then I can try to look into it to find a way.

 

Thank you.

If this post helps, then please consider accepting it as the solution to help other members find it faster, and give a big thumbs up.


Visit my LinkedIn page by clicking here.


Schedule a meeting with me to discuss further by clicking here.

selimovd
Super User
Super User

Hey @AlexisPREVOT ,

 

do you have a proper date dimensional table where each day in the desired time area (including weekends) appears once?

If that is the case did you mark it as data table?

If that is not the case try to add an ALL in you calculation:

TotalPREC =
CALCULATE(
    SUM( LIGNES_FACT[LFC_FACTURE_CONSOLIDEE] ),
    SAMEPERIODLASTYEAR( FACTURES[FCC_DATE] ),
    ALL( FACTURES[FCC_DATE] )
)

 

All of the time intelligence functions only work with a proper date table.

If you need any help please let me know.
If I answered your question I would be happy if you could mark my post as a solution ✔️ and give it a thumbs up 👍
 
Best regards
Denis
 
Jihwan_Kim
Super User
Super User

Hi, @AlexisPREVOT 

Please correct me if I wrongly understand your question.

I think there are some limitations in using sameperiodlastyear.

 

https://docs.microsoft.com/en-us/dax/sameperiodlastyear-function-dax

 

Instead, please try to use DATEADD  DAX function.

 

Hi, My name is Jihwan Kim.

If this post helps, then please consider accept it as the solution to help other members find it faster, and give a big thumbs up.

If this post helps, then please consider accepting it as the solution to help other members find it faster, and give a big thumbs up.


Visit my LinkedIn page by clicking here.


Schedule a meeting with me to discuss further by clicking here.

Helpful resources

Announcements
November Carousel

Fabric Community Update - November 2024

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

Live Sessions with Fabric DB

Be one of the first to start using Fabric Databases

Starting December 3, join live sessions with database experts and the Fabric product team to learn just how easy it is to get started.

Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount! Early Bird pricing ends December 9th.

Nov PBI Update Carousel

Power BI Monthly Update - November 2024

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