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

Be one of the first to start using Fabric Databases. View on-demand sessions with database experts and the Microsoft product team to learn just how easy it is to get started. Watch now

Reply
monika992
New Member

Wrong total value for YTD PY measure

Hi!

I have a problem with total value for YTD PY calculation. I need to analyse data based on specific date. So i need to compare values sold in dates range 01.01.2024-11.04.2024 and same period in previous year - 01.01.2023 - 11.04.2023. I`ve used following measures (using also date table which ends on 11.04.2024). 


Current Year YTD:

Ilosci CY YTD =
 TOTALYTD([Value], 'Tabela kalendarzowa'[Date])

YTD PY:
ytd. Ilości YTD PY = calculate(
                        [Ilosci CY YTD],
                        SAMEPERIODLASTYEAR('Tabela kalendarzowa'[Date])
                    )

Unfortunately, total value for YTD PY shows value for 30.04.2023 not 11.04.2023. How can I solve it?

monika992_2-1713167471480.png

 

 

 

3 REPLIES 3
Ashish_Mathur
Super User
Super User

Hi,

I am not clear about your question from the images that you have posted.  Share some data to work with and show the expected result.  If possible, please ensure column titles are in English.


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/
v-xinruzhu-msft
Community Support
Community Support

Hi ,

Thanks for the solution @lukiz84 provided, and i want to offer some more information for user to refer to.

hello @monika992 , you can try the following measure.

ytd. Ilości YTD PY =
CALCULATE (
    [Ilosci CY YTD],
    SAMEPERIODLASTYEAR ( 'Tabela kalendarzowa'[Date] ),
    'Tabela kalendarzowa'[Date] <= DATE ( 2024, 4, 11 )
)

Best Regards!

Yolo Zhu

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

lukiz84
Memorable Member
Memorable Member

read this 🙂

Differences between DATEADD and PARALLELPERIOD in DAX - SQLBI

 

hint: SAMEPERIODLASTYEAR uses DATEADD.

 

 

Helpful resources

Announcements
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!

Dec Fabric Community Survey

We want your feedback!

Your insights matter. That’s why we created a quick survey to learn about your experience finding answers to technical questions.

ArunFabCon

Microsoft Fabric Community Conference 2025

Arun Ulag shares exciting details about the Microsoft Fabric Conference 2025, which will be held in Las Vegas, NV.

December 2024

A Year in Review - December 2024

Find out what content was popular in the Fabric community during 2024.