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
Anonymous
Not applicable

Show Current Week by default

Hi everyone,
so im using current week filter and all weekNo. filter on left for year 2022,2021,2020 (same weeks)  so that boss can see chose which ever weeks he like.
Need:
but he wants the current week to be showed by default. so if he opens this report he will see the current week sales for the year 2022,2021 and 2020 (same week) and use the all weekNo. filter to see the other weeks other than current.

Saadii_360_0-1643658063586.png

Problem:

Problem is that the way i have used the current filter in dax does not  allow me to use the other all weeks filter. please find below the dax code i have used for current week

SemCourante =
//Current Weeks
if(year(now())&weeknum(now()-1) = year(DMVBICalendarView1[Date])&weeknum(DMVBICalendarView1[Date],1),"Courrante",
if((year(now()))-1&weeknum(now()) = year(DMVBICalendarView1[Date])&weeknum(DMVBICalendarView1[Date],1),"Courrante-1",
if((year(now()))-2&weeknum(now()) = year(DMVBICalendarView1[Date])&weeknum(DMVBICalendarView1[Date],1),"Courrante-2",
if((year(now()))-3&weeknum(now()) = year(DMVBICalendarView1[Date])&weeknum(DMVBICalendarView1[Date],1),"Courrante-3"))))
and please find below the weeknumbers,
Saadii_360_1-1643658595114.png

If any of you can solve this problem that will be a huge help. show me a way to merge weekno. and current week in the same code or column. so current week becomes default but if user selects any weekno. it shows the values as well.
thanks in advance to this wonderful community.

 

2 REPLIES 2
ValtteriN
Super User
Super User

Hi,

To use this logic all you need to do is to add the other  weeks as a selection to the IF logic. So something like this:

if(year(now())&weeknum(now()-1) = year(DMVBICalendarView1[Date])&weeknum(DMVBICalendarView1[Date],1),"Courrante",
if((year(now()))-1&weeknum(now()) = year(DMVBICalendarView1[Date])&weeknum(DMVBICalendarView1[Date],1),"Courrante-1",
if((year(now()))-2&weeknum(now()) = year(DMVBICalendarView1[Date])&weeknum(DMVBICalendarView1[Date],1),"Courrante-2",
if((year(now()))-3&weeknum(now()) = year(DMVBICalendarView1[Date])&weeknum(DMVBICalendarView1[Date],1),"Courrante-3",weeknum(DMVBICalendarView1[Date]))))
Alternatively you can use SWITCH + TRUE for a clearer syntax:

SWITCH(TRUE(),
year(now())&weeknum(now()-1) = year(DMVBICalendarView1[Date])&weeknum(DMVBICalendarView1[Date],1),"Courrante",
year(now()))-1&weeknum(now()) = year(DMVBICalendarView1[Date])&weeknum(DMVBICalendarView1[Date],1),"Courrante-1",
year(now()))-2&weeknum(now()) = year(DMVBICalendarView1[Date])&weeknum(DMVBICalendarView1[Date],1),"Courrante-2",
year(now()))-3&weeknum(now()) = year(DMVBICalendarView1[Date])&weeknum(DMVBICalendarView1[Date],1),"Courrante-3"
weeknum(DMVBICalendarView1[Date]))


I hope this post helps to solve your issue and if it does consider accepting it as a solution and giving the post a thumbs up!

My LinkedIn: https://www.linkedin.com/in/n%C3%A4ttiahov-00001/






Did I answer your question? Mark my post as a solution!

Proud to be a Super User!




Anonymous
Not applicable

No. I just want current week by default. But when i click on other weeks it should not show blank values because of the current week filter.

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.