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

Earn a 50% discount on the DP-600 certification exam by completing the Fabric 30 Days to Learn It challenge.

Reply
jiji
Frequent Visitor

Filter table starting from Current Week to 12 more future weeks

Hi Team - Could you please help me how to expose this filter using DAX? I need to show values that always starts in current week Monday to Sunday to 12 more future weeks. I was only able to create "Current week & Next week" as per below:

Column =
VAR next =
    TODAY () + 7
VAR yn =
    YEAR ( next )
VAR yt =
    YEAR ( TODAY () )
VAR weeknumt =
    WEEKNUM ( TODAY () )
VAR weeknun =
    WEEKNUM ( next )
VAR wek =
    WEEKNUM ( 'date'[Date] )
RETURN
    IF (
        OR (
            yn = YEAR ( 'date'[Date] )
                && weeknun = wek,
            yt = YEAR ( 'date'[Date] )
                && weeknumt = wek
        ),
        "current week & next week",
        BLANK ()
    )
1 ACCEPTED SOLUTION
v-rongtiep-msft
Community Support
Community Support

Hi @jiji ,

I have created a simple sample, please refer to it to see if it helps you.

Create a column.

Column =
VAR _weeknum =
    WEEKNUM ( 'date'[Date], 1 )
VAR _weeknumtoday =
    WEEKNUM ( TODAY (), 1 )
RETURN
    IF (
        _weeknum >= _weeknumtoday
            && _weeknum <= _weeknumtoday + 12,
        "currentWk to 12 more future wks",
        BLANK ()
    )

Then you can filter the column is not blank.

vpollymsft_0-1661842192171.png

If I have misunderstood your meaning, please provide more details with your desired output and your pbix file without privacy information.

 

Best Regards

Community Support Team _ Polly

 

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

2 REPLIES 2
v-rongtiep-msft
Community Support
Community Support

Hi @jiji ,

I have created a simple sample, please refer to it to see if it helps you.

Create a column.

Column =
VAR _weeknum =
    WEEKNUM ( 'date'[Date], 1 )
VAR _weeknumtoday =
    WEEKNUM ( TODAY (), 1 )
RETURN
    IF (
        _weeknum >= _weeknumtoday
            && _weeknum <= _weeknumtoday + 12,
        "currentWk to 12 more future wks",
        BLANK ()
    )

Then you can filter the column is not blank.

vpollymsft_0-1661842192171.png

If I have misunderstood your meaning, please provide more details with your desired output and your pbix file without privacy information.

 

Best Regards

Community Support Team _ Polly

 

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

 

Jihwan_Kim
Super User
Super User

Hi,

I am not sure how your Dates Table looks like, but I tried to create a sample like the attached.

Please check the below DAX formula for creating a new column and the attached pbix file.

 

Expected outcome CC =
VAR _addweeknumbercol =
    ADDCOLUMNS (
        Dates,
        "@weeknumber", WEEKNUM ( Dates[Date] ),
        "@year", YEAR ( Dates[Date] )
    )
VAR _futuredate =
    TODAY () + 84
VAR _weeknumberaftereightyfourdays =
    MAXX ( FILTER ( _addweeknumbercol, Dates[Date] = _futuredate ), [@weeknumber] )
VAR _yearnumberaftereightyfourdays =
    MAXX ( FILTER ( _addweeknumbercol, Dates[Date] = _futuredate ), [@year] )
VAR _lastdateaftereightyfourdays =
    MAXX (
        FILTER (
            _addweeknumbercol,
            [@weeknumber] = _weeknumberaftereightyfourdays
                && [@year] = _yearnumberaftereightyfourdays
        ),
        Dates[Date]
    )
RETURN
    IF (
        Dates[Date] >= TODAY ()
            && Dates[Date] <= _lastdateaftereightyfourdays,
        "currentWk to 12 more future wks",
        "Others"
    )

If this post helps, then please consider accepting it as the solution to help other members find it faster, and give a big thumbs up.


Go to My LinkedIn Page


Helpful resources

Announcements
LearnSurvey

Fabric certifications survey

Certification feedback opportunity for the community.

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

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

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.

Top Solution Authors