cancel
Showing results for
Did you mean:

Find everything you need to get certified on Fabric—skills challenges, live sessions, exam prep, role guidance, and more. Get started

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))

1 ACCEPTED SOLUTION
Frequent Visitor

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))

5 REPLIES 5
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))

Helper I

@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))
Frequent Visitor

Thanks,

But I tried it but it didn't work.

Resolver I

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

Frequent Visitor

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))

Announcements

#### Europe’s largest Microsoft Fabric Community Conference

Join the community in Stockholm for expert Microsoft Fabric learning including a very exciting keynote from Arun Ulag, Corporate Vice President, Azure Data.

#### Power BI Monthly Update - August 2024

Check out the August 2024 Power BI update to learn about new features.

#### Fabric Community Update - August 2024

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

Top Solution Authors
Top Kudoed Authors