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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
Anonymous
Not applicable

Calculate YTD

Hi

 

I am having my fact at month level granularity and hence I have MonthId in my fact table. I have mapping on MonthId column between fact and date dimension table. I want to check is it possible to create YTD measure based on date dimension with month level granularity ? 

3 REPLIES 3
hnguy71
Memorable Member
Memorable Member

Is your MonthID a unique identifier and pairs 1 to 1 with your date table? What about your date table? What's the start and end dates? How did you create / retrieve the dates? Where is the data being stored? How do you know which year the dataset belongs to?



Did I answer your question?
Please help by clicking the thumbs up button and mark my post as a solution!
Anonymous
Not applicable

Yes, MonthId is a unique key in dim table. Mapping is there between fact and dimension based on MonthId column. There are other columns also present i.e. MonthName, Year, Quarter...

As long as you have a foreign key to the dim table it's possible.

 

SampleYTD1 = TotalYTD(Sum(FROM WHERE), Date Table[Date Column], Any Filters)

 

SampleYTD2 = Calculate(Sum(FROM WHERE), Datesbetween(Date Table, Begin Date, End Date))

 

I prefer using the second YTD measure for better control



Did I answer your question?
Please help by clicking the thumbs up button and mark my post as a solution!

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

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

April Fabric Community Update

Fabric Community Update - April 2024

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