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 have a very typical data model with a Sales fact table and a Dates table. I have a measure that looks like this:
Hi @bvy ,
You need to pick up the last week that has data so you need to do somethig similar to the following:
SalesLastWeek =
VAR MAXWEEKYEAR =
MAXX (
TOPN (
1,
FILTER (
ALL ( Dates[WeeKNumYear] ),
Dates[WeeKNumYear] <= MAX ( Dates[WeeKNumYear] )
),
Dates[WeeKNumYear], DESC
),
Dates[WeeKNumYear]
)
RETURN
CALCULATE (
[Sales],
FILTER ( ALL ( Dates ), Dates[WeekNumYear] = MAXWEEKYEAR )
)
I added a WeenunmYear because if you only have week num on the change of year result will be incorrect.
Regards
Miguel Félix
Proud to be a Super User!
Check out my blog: Power BI em PortuguêsCovering 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 |
---|---|
111 | |
94 | |
83 | |
66 | |
59 |
User | Count |
---|---|
151 | |
121 | |
104 | |
87 | |
67 |