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

Grow your Fabric skills and prepare for the DP-600 certification exam by completing the latest Microsoft Fabric challenge.

Reply
lstenz
Frequent Visitor

Sameperiodlastyear YTD not working as intended

Hey,

 

I am tasked with creating a YTD value and a value that shows the percentage change from last year's data of the same timeframe.

So I created 3 measures:

 

YTD: 

CALCULATE(sum('KPIs_GoogleSearchConsole'[Organic Impressions]),filter(ALL('LU_DATES'),'LU_DATES'[Year]=max('LU_DATES'[Year])))

 

LYTD: 

CALCULATE(sum('KPIs_GoogleSearchConsole'[Organic Impressions]),SAMEPERIODLASTYEAR(LU_DATES[Date]))

 

DELTA: 

DIVIDE( [GSCOrgImprThisYear] , [GSCOrgImprLastYear]) - 1

 

I created a table to see if it works and as far as I understand, the LYTD should show me data next to the 2 million from jan 23, right? This also means that the delta doesn't work as I want it to and I've spent about 6 hours over the past two days, trying to figure this out and searching for a solution. (Just started working with PowerBi)

 

Bildschirm­foto 2023-01-14 um 17.05.20.png

Please help


Leo

1 ACCEPTED SOLUTION
vanessafvg
Super User
Super User

can you provide some sample data in text form 

 

for this measure

CALCULATE(sum('KPIs_GoogleSearchConsole'[Organic Impressions]),filter(ALL('LU_DATES'),'LU_DATES'[Year]=max('LU_DATES'[Year])))

 

is there a reason you aren't using the YTD functions in power bi?

 

so providing some sample data with an example of what you are expecting will help solve the issue.

thanks





If I took the time to answer your question and I came up with a solution, please mark my post as a solution and /or give kudos freely for the effort 🙂 Thank you!

Proud to be a Super User!




View solution in original post

2 REPLIES 2
vanessafvg
Super User
Super User

can you provide some sample data in text form 

 

for this measure

CALCULATE(sum('KPIs_GoogleSearchConsole'[Organic Impressions]),filter(ALL('LU_DATES'),'LU_DATES'[Year]=max('LU_DATES'[Year])))

 

is there a reason you aren't using the YTD functions in power bi?

 

so providing some sample data with an example of what you are expecting will help solve the issue.

thanks





If I took the time to answer your question and I came up with a solution, please mark my post as a solution and /or give kudos freely for the effort 🙂 Thank you!

Proud to be a Super User!




I can't believe it but after actually using the totalytd function instead of what I previously used, it actually works now. I got the initial formula from a tutorial and since the value was right, I just went along with it and thought the problem was with the sply function. 

 

Thank you so much for helping me with this!

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.

RTI Forums Carousel3

New forum boards available in Real-Time Intelligence.

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

MayPowerBICarousel1

Power BI Monthly Update - May 2024

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