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

Don't miss out! 2025 Microsoft Fabric Community Conference, March 31 - April 2, Las Vegas, Nevada. Use code MSCUST for a $150 discount. Prices go up February 11th. Register now.

Reply
gsulaimon
Frequent Visitor

Last week Dax

Dear All, 
 
I have this formula below to calculate period in date for weeks but it keeps bringing the wrong data 
 
Last week = CALCULATE([PPE Lsum], DATESINPERIOD('Calendar'[date], TODAY(),-7,DAY))
 
LastWeek = CALCULATE(SUM('Occupational Safety'[Value]),filter(ALL('Occupational Safety'[Week]),'Occupational Safety'[Week]=WEEKNUM(TODAY(),1)-1))
 
 
Please assist,
 
1 ACCEPTED SOLUTION

ThanK you @deevaker the solutioin worked. 

LastWeek = CALCULATE(SUM('Occupational Safety'[Value]),filter(ALLEXCEPT('Occupational Safety','Occupational Safety'[PPE],'Occupational Safety'[YEAR]),'Occupational Safety'[Week]=WEEKNUM(TODAY(),1)-1))

View solution in original post

5 REPLIES 5
deevaker
Resolver I
Resolver I

First measure looks correct. Hope the relationship between your tables are fine.

 

In second table, look like you need to use >= instead of = while doing filter.

LastWeek = CALCULATE(SUM('Occupational Safety'[Value]),filter(ALL('Occupational Safety'[Week]),'Occupational Safety'[Week]>=WEEKNUM(TODAY(),1)-1))

@deevaker  Could you look at my Dax Measure? do all columns have to reference the same table?

 

LastWeek = CALCULATE(COUNT('SSRS_MissionServices_ActivitesDetail_view'[ActivityID]), 'dimDate'[CalendarYear]),'dimDate'[ISOWeekNumber]=WEEKNUM(TODAY(),1)-1))

Thanks, 

But I tried it but it didn't work. 

Shall we check. you can ping me on skype - deevaker1

ThanK you @deevaker the solutioin worked. 

LastWeek = CALCULATE(SUM('Occupational Safety'[Value]),filter(ALLEXCEPT('Occupational Safety','Occupational Safety'[PPE],'Occupational Safety'[YEAR]),'Occupational Safety'[Week]=WEEKNUM(TODAY(),1)-1))

Helpful resources

Announcements
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount! Prices go up Feb. 11th.

Jan25PBI_Carousel

Power BI Monthly Update - January 2025

Check out the January 2025 Power BI update to learn about new features in Reporting, Modeling, and Data Connectivity.

Jan NL Carousel

Fabric Community Update - January 2025

Find out what's new and trending in the Fabric community.