Return current week count


#1

I have have a measure calculating the total number of inspections. I want to show only the current weeks inspections. I use your Dates tables so i have the week number field. How do i filter and only show the current week? I created a Measure call CurrentWeek = WeekNum, TODAY(), 2 which gives me my current week. Is there a way to filter and say give me the inspections for the week that equals CurrentWeek? Or is there an easier way?

image


#2

I would solve this in the date table with a calculated column, then you’re formulas become very easy.

Here’s the formula I created for this

Current Week = 
VAR IsYear = IF( YEAR( TODAY() ) = VALUE( Dates[Year] ), TRUE(), FALSE() )
VAR IsWeek = IF( WEEKNUM( TODAY() ) = Dates[Week Number], TRUE(), FALSE() )

RETURN
IF( AND( IsYear, IsWeek ), TRUE(), FALSE() )

image

Now that you have this, you can create calculation quite easily for the current week.

Using combination like this.

CALCULATE( SUM( Column ), Current Week = True )

See how you go with these ideas.

Chrs