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

Last Value of previuos week

Hi,

i have a table (Ratings) with multiple values (5 Star Ratings) per day and they're cumulated, like this:

DateWeekdayWeeknum5 Star Ratings
28.02SUN91.000
28.02.SUN91.100
01.03MON101.150
01.03MON101.160
02.03TUE101.200
03.03WED101.300
03.03WED101.356
...   
07.03SUN101.500

 

GOAL: I want a measure that is showing me per week the last value of the previous week. So i can calculate averages etc. with differences etc.

So like: 

 Current Previous
Week 91.100...
Wek 101.5001.100

 

Current week is easy with SUM and MAX Date. 

 

For previous week I tried like this:

Prev.Week = 

CALCULATE(SUM(Ratings[5Star]),FILTER(ALL(Ratings),Ratings[Weeknum]=MAX(Ratings[Weeknum])-1&&Ratings[Date]=MAX(Ratings[Date])))

 

It doesn't show me anything.

Thx for your help.

Micha

 

1 ACCEPTED SOLUTION
themistoklis
Community Champion
Community Champion

@Anonymous 

 

You can try the following formula:

 

 

 

Prev.Week = 
CALCULATE(SUM(Ratings[5Star]),FILTER(ALL(Ratings),Ratings[Weeknum]=(MAX(Ratings[Weeknum])-1) && Ratings[Date]=(Ratings[Date]+ 7-WEEKDAY(Ratings[Date],2)) ) )

 

 

 

View solution in original post

4 REPLIES 4
themistoklis
Community Champion
Community Champion

@Anonymous 

 

You can try the following formula:

 

 

 

Prev.Week = 
CALCULATE(SUM(Ratings[5Star]),FILTER(ALL(Ratings),Ratings[Weeknum]=(MAX(Ratings[Weeknum])-1) && Ratings[Date]=(Ratings[Date]+ 7-WEEKDAY(Ratings[Date],2)) ) )

 

 

 

Anonymous
Not applicable

@amitchandak thx. Weekrank helped a lot thx.

I have the sum of the previous week so far:

CALCULATE(SUM(Ratings_iOS[1Star]),FILTER(ALL(Date_global),Date_global[Week Rank]=MAX(Date_global[Week Rank])-1))
 
How do i combine it with MAX, to get only the latest value of the previous week?
 

@Anonymous 

 

If you want the value from last day of previous week try adding this to your formula:

&& Ratings[Date]=(Ratings[Date]+ 7-WEEKDAY(Ratings[Date],2))

 

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.