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

Power BI is turning 10! Let’s celebrate together with dataviz contests, interactive sessions, and giveaways. Register now.

Reply
ULTRAVI0LENCE
New Member

Week Over Week DAX Count for Previous Week

I've created a measure that uses calculated columns that counts rows with a specific value, see below.

 

Calls This Week = CALCULATE(COUNTROWS(AllContacts),FILTER(AllContacts,AllContacts[Contact_System]="Call Center"),FILTER(ALL(AllContacts),AllContacts[WeekRank]=MAX(AllContacts[WeekRank])))
 
This expression works & gives me an accurate number of calls for a given week with the filter applied for only rows with "Call Center". The next step would be to calculate the same data for the previous week. The DAX I wrote for that purpose is very similar below, but does not return anything.
 
Calls Last Week = CALCULATE(COUNTROWS(AllContacts),FILTER(AllContacts,AllContacts[Contact_System]="Call Center"),FILTER(ALL(AllContacts),AllContacts[WeekRank]=MAX(AllContacts[WeekRank])-1))
 
I subtract 1 from the week rank to return the previous week, but this does not prove to be useful. Anyone familiar with this issue?
 
2 REPLIES 2
FreemanZ
Super User
Super User

Hi @ULTRAVI0LENCE ,

 

try like:

CountPreviousWeekColumn= 
COUNTROWS(
    FILTER(
        AllContacts,
        AllContacts[Contact_System]="Call Center"
            &&AllContacts[WeekRank] = EARLIER(AllContacts[WeekRank]) -1
    )
)

Thank you for the reply,

 

The EARLIER DAX expression does not accept my column AllContacts[WeekRank] as a parameter. An error is thrown on this specific parameter. Any tips on this?

Helpful resources

Announcements
June 2025 Power BI Update Carousel

Power BI Monthly Update - June 2025

Check out the June 2025 Power BI update to learn about new features.

June 2025 community update carousel

Fabric Community Update - June 2025

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

Top Solution Authors