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

Measure Calculate until last week

I'm trying to get a measure right. 

 

Certain grades are given and I want to see how they progress every week. For that I try to write a measure that has the average of the grade number and filters until the last week.

 

Unfortunately I cannot get a dynamic week date where the measure has the current week minus 1 (so that it shows the average until last week). Hope someone can help out. 

 

test =

calculate(AVERAGE(table[number]),WEEKNUM('Calendar'[Date])-1)
1 ACCEPTED SOLUTION
jppv20
Solution Sage
Solution Sage

Hi @Anonymous ,

 

First, create a weeknumber column in your calendar table:

WeekNumber = WEEKNUM('Calendar'[Date],2)
 
Then create a measure like this:
test =
var Maxdate = WEEKNUM(TODAY(),2)-1
return
CALCULATE(AVERAGE('Table'[Number]),'Calendar'[WeekNumber]<=Maxdate)
 
If I answered your question, please mark it as a solution to help other members find it more quickly.

View solution in original post

1 REPLY 1
jppv20
Solution Sage
Solution Sage

Hi @Anonymous ,

 

First, create a weeknumber column in your calendar table:

WeekNumber = WEEKNUM('Calendar'[Date],2)
 
Then create a measure like this:
test =
var Maxdate = WEEKNUM(TODAY(),2)-1
return
CALCULATE(AVERAGE('Table'[Number]),'Calendar'[WeekNumber]<=Maxdate)
 
If I answered your question, please mark it as a solution to help other members find it more quickly.

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.