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.
Hello,
I'm trying to do a YTD comparison between this year and last. I have two formulas below, one for the Current Year and one for the Prior Year. For some reason, the Current Year calculation is working correctly, but when I apply SAMEPERIODLASTYEAR for the Prior Year calculation, the dates for the entire month of January are brought in. Here are my forumlas:
# Deals YTD = TOTALYTD(SUM('Deal Activity'[Count]),'Date'[Date])
And for the Prior Year YTD:
# Deals PYD = CALCULATE([# Deals YTD],SAMEPERIODLASTYEAR('Date'[Date]))
As noted, the second formula is calculating a Total for 1/1/2018-1/31/2018, but I only want it to show 1/1/2018-1/17/2018. Does anyone know why it would bring in the whole month?
Thanks
Solved! Go to Solution.
Hi @smpatric,
If you only want to get the same period of the dates. We can take the following steps.
1. Create a new date table and create relationship between it and the fact table.
date = CALENDAR(MIN('Deal Activity'[date]),MAX('Deal Activity'[date]))
Year = YEAR('date'[Date])
2. Create a measure as below.
Previsou = TOTALYTD(SUM('Deal Activity'[Count]),DATEADD('date'[Date],-365,DAY))
I guess that should be the issue of the way creating date table. So I create a new one here to work on it.
For more details, please check the pbix as attached.
Regards,
Frank
Hi @smpatric,
If you only want to get the same period of the dates. We can take the following steps.
1. Create a new date table and create relationship between it and the fact table.
date = CALENDAR(MIN('Deal Activity'[date]),MAX('Deal Activity'[date]))
Year = YEAR('date'[Date])
2. Create a measure as below.
Previsou = TOTALYTD(SUM('Deal Activity'[Count]),DATEADD('date'[Date],-365,DAY))
I guess that should be the issue of the way creating date table. So I create a new one here to work on it.
For more details, please check the pbix as attached.
Regards,
Frank
Thanks Frank. Should have thought of that, but worked like a charm!
Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City
Check out the April 2024 Power BI update to learn about new features.
User | Count |
---|---|
114 | |
99 | |
83 | |
70 | |
60 |
User | Count |
---|---|
150 | |
115 | |
104 | |
89 | |
65 |