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.
I am trying to get a formula to work so it will automatically update as new weekly data comes in.
With these formulas I can get it to work
When I switch the 2019 YTD formula to
IHow can I work around this so I can keep comparing same weeks YTD to previous years. I am getting confused.
Solved! Go to Solution.
Hi @AdrianneNokes ,
I created some data:
Here are the steps you can follow:
1. Create measure.
CYMAXWK =
MAXX(
FILTER( ALL('Table'),'Table'[Date]=MAXX(ALL('Table'),'Table'[Date])),WEEKNUM('Table'[Date],1))
2019 YTD =
SUMX(
FILTER(ALL('Table'),'Table'[Date]>=DATE(2019,1,1)&&'Table'[Date]<=MAXX(FILTER(ALL('Table'),WEEKNUM('Table'[Date],1)=[CYMAXWK]&&YEAR('Table'[Date])=2019),[Date])),[rand])
2022 YTD =
SUMX(
FILTER(ALL('Table'),
'Table'[Date]>=DATE(YEAR(TODAY()),1,1)&&
'Table'[Date]<=TODAY()
),[rand])
2. Result:
Best Regards,
Liu Yang
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly
Hi @AdrianneNokes ,
I created some data:
Here are the steps you can follow:
1. Create measure.
CYMAXWK =
MAXX(
FILTER( ALL('Table'),'Table'[Date]=MAXX(ALL('Table'),'Table'[Date])),WEEKNUM('Table'[Date],1))
2019 YTD =
SUMX(
FILTER(ALL('Table'),'Table'[Date]>=DATE(2019,1,1)&&'Table'[Date]<=MAXX(FILTER(ALL('Table'),WEEKNUM('Table'[Date],1)=[CYMAXWK]&&YEAR('Table'[Date])=2019),[Date])),[rand])
2022 YTD =
SUMX(
FILTER(ALL('Table'),
'Table'[Date]>=DATE(YEAR(TODAY()),1,1)&&
'Table'[Date]<=TODAY()
),[rand])
2. Result:
Best Regards,
Liu Yang
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly
Hi @AdrianneNokes ,
Are you using a marked date table in your model? I mocked up some data with a standard date table and used sameperiodlastyear with a slicer and getting the results I expected.
If this is helpful, please mark as a solution so others can find it too! Thanks, Tom 😀
Date Table (DAX)
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 |
---|---|
49 | |
26 | |
21 | |
15 | |
12 |
User | Count |
---|---|
57 | |
49 | |
44 | |
19 | |
18 |