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

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

Reply
Barculez
Regular Visitor

Week filter

Hey,

 

I would like to ask you for help with a filter, I have a dashboard where are 4 charts - it is a weekly report, one chart shows data for the last 12 weeks, 2 charts for last 4 weeks and one is for the current week.

 

Is it possible to create 1 filter for all of them (ideally for the whole set) where the current week could be selected and the other charts would subtract the weeks? Or is there a solution that would be simple to filter such charts?

 

Thank you 

1 ACCEPTED SOLUTION
Anonymous
Not applicable

Hi  @Barculez ,

I created some data:

vyangliumsft_0-1689839426187.png

 

Here are the steps you can follow:

1. Create calculated column.

 

Slicer = 
IF(
    WEEKNUM('Table'[Date],2) = WEEKNUM(TODAY(),2),"Current Week","W"&""&WEEKNUM('Table'[Date],2))

 

2. Create calculated table.

 

Slicer_Table =
DISTINCT(
    'Table'[Slicer])

 

vyangliumsft_1-1689839426190.png

3. Create measure.

 

Flag_current =
var _select=SELECTEDVALUE('Slicer_Table'[Slicer])
return
    IF(
_select="Current Week" ,
SUMX(
    FILTER(ALL('Table'),'Table'[Date]=MAX('Table'[Date])&&WEEKNUM('Table'[Date],2)= WEEKNUM(TODAY(),2)),[rand]),
SUMX(    FILTER(ALL('Table'),'Table'[Date]=MAX('Table'[Date])&&WEEKNUM('Table'[Date],2)=VALUE(RIGHT(_select,LEN(_select)-1))),[rand]))
Flag_4 =
var _select=SELECTEDVALUE('Slicer_Table'[Slicer])
return
    IF(
_select="Current Week" ,
SUMX(
    FILTER(ALL('Table'),'Table'[Date]=MAX('Table'[Date])&&WEEKNUM('Table'[Date],2)= WEEKNUM(TODAY(),2)-4),[rand]),
SUMX(    FILTER(ALL('Table'),'Table'[Date]=MAX('Table'[Date])&&WEEKNUM('Table'[Date],2)=VALUE(RIGHT(_select,LEN(_select)-1))-4),[rand]))
Flag_12 =
var _select=SELECTEDVALUE('Slicer_Table'[Slicer])
return
    IF(
_select="Current Week" ,
SUMX(
    FILTER(ALL('Table'),'Table'[Date]=MAX('Table'[Date])&&WEEKNUM('Table'[Date],2)= WEEKNUM(TODAY(),2)-12),[rand]),
SUMX(  FILTER(ALL('Table'),'Table'[Date]=MAX('Table'[Date])&&WEEKNUM('Table'[Date],2)=VALUE(RIGHT(_select,LEN(_select)-1))-12),[rand]))

 

4. Result:

Select Current Week:

vyangliumsft_2-1689839566430.png

Select W17:

vyangliumsft_3-1689839566435.png

 

 

Best Regards,

Liu Yang

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly

View solution in original post

1 REPLY 1
Anonymous
Not applicable

Hi  @Barculez ,

I created some data:

vyangliumsft_0-1689839426187.png

 

Here are the steps you can follow:

1. Create calculated column.

 

Slicer = 
IF(
    WEEKNUM('Table'[Date],2) = WEEKNUM(TODAY(),2),"Current Week","W"&""&WEEKNUM('Table'[Date],2))

 

2. Create calculated table.

 

Slicer_Table =
DISTINCT(
    'Table'[Slicer])

 

vyangliumsft_1-1689839426190.png

3. Create measure.

 

Flag_current =
var _select=SELECTEDVALUE('Slicer_Table'[Slicer])
return
    IF(
_select="Current Week" ,
SUMX(
    FILTER(ALL('Table'),'Table'[Date]=MAX('Table'[Date])&&WEEKNUM('Table'[Date],2)= WEEKNUM(TODAY(),2)),[rand]),
SUMX(    FILTER(ALL('Table'),'Table'[Date]=MAX('Table'[Date])&&WEEKNUM('Table'[Date],2)=VALUE(RIGHT(_select,LEN(_select)-1))),[rand]))
Flag_4 =
var _select=SELECTEDVALUE('Slicer_Table'[Slicer])
return
    IF(
_select="Current Week" ,
SUMX(
    FILTER(ALL('Table'),'Table'[Date]=MAX('Table'[Date])&&WEEKNUM('Table'[Date],2)= WEEKNUM(TODAY(),2)-4),[rand]),
SUMX(    FILTER(ALL('Table'),'Table'[Date]=MAX('Table'[Date])&&WEEKNUM('Table'[Date],2)=VALUE(RIGHT(_select,LEN(_select)-1))-4),[rand]))
Flag_12 =
var _select=SELECTEDVALUE('Slicer_Table'[Slicer])
return
    IF(
_select="Current Week" ,
SUMX(
    FILTER(ALL('Table'),'Table'[Date]=MAX('Table'[Date])&&WEEKNUM('Table'[Date],2)= WEEKNUM(TODAY(),2)-12),[rand]),
SUMX(  FILTER(ALL('Table'),'Table'[Date]=MAX('Table'[Date])&&WEEKNUM('Table'[Date],2)=VALUE(RIGHT(_select,LEN(_select)-1))-12),[rand]))

 

4. Result:

Select Current Week:

vyangliumsft_2-1689839566430.png

Select W17:

vyangliumsft_3-1689839566435.png

 

 

Best Regards,

Liu Yang

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly

Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!

December 2025 Power BI Update Carousel

Power BI Monthly Update - December 2025

Check out the December 2025 Power BI Holiday Recap!

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.