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

Find everything you need to get certified on Fabric—skills challenges, live sessions, exam prep, role guidance, and more. Get started

Reply
Saadii_360
Helper I
Helper I

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!




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
Fabcon_Europe_Social_Bogo

Europe’s largest Microsoft Fabric Community Conference

Join the community in Stockholm for expert Microsoft Fabric learning including a very exciting keynote from Arun Ulag, Corporate Vice President, Azure Data.

Power BI Carousel June 2024

Power BI Monthly Update - June 2024

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

PBI_Carousel_NL_June

Fabric Community Update - June 2024

Get the latest Fabric updates from Build 2024, key Skills Challenge voucher deadlines, top blogs, forum posts, and product ideas.

RTI Forums Carousel3

New forum boards available in Real-Time Intelligence.

Ask questions in Eventhouse and KQL, Eventstream, and Reflex.