Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.
Solved! Go to Solution.
Hi @Anonymous ,
Sorry for my late respond, we can adjust the formula as below.
Column =
VAR next =
TODAY () + 7
VAR yn =
YEAR ( next )
VAR yt =
YEAR ( TODAY () )
VAR weeknumt =
WEEKNUM ( TODAY (),2 )
VAR weeknun =
WEEKNUM ( next,2 )
VAR wek =
WEEKNUM ( 'date'[Date],2 )
RETURN
IF (
OR (
yn = YEAR ( 'date'[Date] )
&& weeknun = wek,
yt = YEAR ( 'date'[Date] )
&& weeknumt = wek&& WEEKDAY('date'[Date],2)<=5
),
"current week & next week",
BLANK ()
)
As the picture above, Sat and Sunday have been exculded for current week.
Hi,
What if the next weeks are in the next year ? This formula doesn't seems to work correcly.. any help?
Thanks!
Formula I'm using :
Hi @Anonymous ,
I have created a sample for your reference, please check the pbix as attached.
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 ()
)
First create a date table and join it with you fact
To get the best of the time intelligence function. Make sure you have a date calendar and it has been marked as the date in model view. Also, join it with the date column of your fact/s.
In your date table have week number.
You can create a formula lagging seven days and it should work
before 7 day = CALCULATE(sum(Sales[Sales Amount]),dateadd('Date'[date],-7,DAY))
Refer
https://radacad.com/creating-calendar-table-in-power-bi-using-dax-functions
Appreciate your Kudos. In case, this is the solution you are looking for, mark it as the Solution. In case it does not help, please provide additional information and mark me with @
Thanks. My Recent Blog -
https://community.powerbi.com/t5/Community-Blog/HR-Analytics-Active-Employee-Hire-and-Termination-tr...
https://community.powerbi.com/t5/Community-Blog/Power-BI-Working-with-Non-Standard-Time-Periods/ba-p...
https://community.powerbi.com/t5/Community-Blog/Comparing-Data-Across-Date-Ranges/ba-p/823601
@Anonymous Please create a calculated column as per below. If the week number is equivalent to current week number or week number one plus one then return true. you can use this column in filter.
Column =
VAR _weeknum = WEEKNUM(TODAY())
RETURN IF(WEEKNUM('Table'[Date])=_weeknum||WEEKNUM('Table'[Date])= _weeknum+1,TRUE(),FALSE())
Thanks
Is there any option to filter only monday to friday in current week
i.e sunday and saturday to be excluded..
According to your query week is starting from sunday how to start from monday?
Hi @Anonymous ,
Sorry for my late respond, we can adjust the formula as below.
Column =
VAR next =
TODAY () + 7
VAR yn =
YEAR ( next )
VAR yt =
YEAR ( TODAY () )
VAR weeknumt =
WEEKNUM ( TODAY (),2 )
VAR weeknun =
WEEKNUM ( next,2 )
VAR wek =
WEEKNUM ( 'date'[Date],2 )
RETURN
IF (
OR (
yn = YEAR ( 'date'[Date] )
&& weeknun = wek,
yt = YEAR ( 'date'[Date] )
&& weeknumt = wek&& WEEKDAY('date'[Date],2)<=5
),
"current week & next week",
BLANK ()
)
As the picture above, Sat and Sunday have been exculded for current week.
Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City
Check out the April 2024 Power BI update to learn about new features.
User | Count |
---|---|
109 | |
99 | |
77 | |
66 | |
54 |
User | Count |
---|---|
144 | |
104 | |
102 | |
87 | |
64 |