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

Earn a 50% discount on the DP-600 certification exam by completing the Fabric 30 Days to Learn It challenge.

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
LearnSurvey

Fabric certifications survey

Certification feedback opportunity for the community.

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.