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

Join us for an expert-led overview of the tools and concepts you'll need to become a Certified Power BI Data Analyst and pass exam PL-300. Register now.

Reply
Anonymous
Not applicable

Last two complete weeks with text filter

Hi,

 

I have a issue I can't seem to figure out myself. I have a measure that counts number of rows from my table for the last two weeks from today. Then I use a filter to count only rows that contains certain countries. This works exactly as expected. 
Then I want to do the exact same thing for rolling last two complete weeks. Counting works fine using this measure:

 

Last two complete weeks =
CALCULATE(
            COUNTROWS(
        Table1
        ),
        Date[RelativeISOWeekNumber] in {-1, -2}
        )

 

 

The difference comes when I use this measure to count the number of rows with textfilter..

 

Filtered Complete two weeks = 

VAR _ENG = CALCULATE([Last two complete weeks], 
            FILTER(
                Table1, 
                LEFT(Table1[Description], 3) = "Eng") 
                )

VAR _WA = CALCULATE([Last two complete weeks], 
            FILTER(
                Table1, 
                LEFT(Table1[Description], 3) = "Wal") 
                )
Return 
_ENG + _WA

 

 

the only thing that I've changed from rolling last two weeks is the date filter. The working one I'm using using this:

DATESBETWEEN(v_dimDato[Dato_Id], TODAY() - 14, TODAY())
 
Anyone know how I can solve this?
 
Thanks.
1 ACCEPTED SOLUTION
Ahmedx
Super User
Super User

try this

Filtered Complete two weeks =

VAR _ENG = CALCULATE([Last two complete weeks],
FILTER(ALL(
Table1),
LEFT(Table1[Description], 3) = "Eng")
)

VAR _WA = CALCULATE([Last two complete weeks],
FILTER(ALL(
Table1),
LEFT(Table1[Description], 3) = "Wal")
)
Return
_ENG + _WA

View solution in original post

1 REPLY 1
Ahmedx
Super User
Super User

try this

Filtered Complete two weeks =

VAR _ENG = CALCULATE([Last two complete weeks],
FILTER(ALL(
Table1),
LEFT(Table1[Description], 3) = "Eng")
)

VAR _WA = CALCULATE([Last two complete weeks],
FILTER(ALL(
Table1),
LEFT(Table1[Description], 3) = "Wal")
)
Return
_ENG + _WA

Helpful resources

Announcements
Join our Fabric User Panel

Join our Fabric User Panel

This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.

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.