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

Enhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends September 15. Request your voucher.

Reply
ivaylodemirev
New Member

Report for week and 2 week ago

I have date table Date whith columns Date, Week_ISO.
For Week_ISO i have formula WEEKNUM([Date],21).
There is a another table Tasks where I have column DocumentNo and TaskDate.
This two tables are related by Date and TaskDate.

I have to make report for Number of document per chosen week and Number of documents per chosen Week -2.
Report must have fitler by Week_ISO from Column Date.
I want to make measures:
1. Sites per Week - which counted distinct DocumentNo were Week for TaskDate = selected values for filter WEEK_ISO from Date.
2. Sites for 2 Week Ago - which counted distinct DocumentNo where Week for TaskDate = selected values for filter with WEEK_ISO- 2 weeks.

1 ACCEPTED SOLUTION
Anonymous
Not applicable

Hi @ivaylodemirev ,

 

According to your description, here are my steps you can follow as a solution.

(1) This is my test data.  

vtangjiemsft_0-1682060866264.png

Date = ADDCOLUMNS(CALENDAR(DATE(2022,1,1),DATE(2022,12,31)) ,
"Week_ISO",WEEKNUM([Date],21))

vtangjiemsft_1-1682060893751.png

(2) We can create two measures. 

Sites per Week = 
var _select=SELECTEDVALUE('Date'[Week_ISO])

return
COUNTROWS(FILTER(ALL('Task'),WEEKNUM('Task'[TaskDate],21)=_select))
Sites for 2 Week Ago = 

var _select=SELECTEDVALUE('Date'[Week_ISO])

return
COUNTROWS(FILTER(ALL('Task'),WEEKNUM('Task'[TaskDate],21)+2=_select))

(3) Then the result is as follows.

vtangjiemsft_2-1682060944542.png

 

If the above one can't help you get the desired result, please provide some sample data in your tables (exclude sensitive data) with Text format and your expected result with backend logic and special examples. It is better if you can share a simplified pbix file. Thank you.

 

Best Regards,

Neeko Tang

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

3 REPLIES 3
ivaylodemirev
New Member

Also i made new column in Date table:
Date- 14 which is Date - 14 days.
Week - 2 which is Weeknum(Date-14, 21)
I made new columns in Task  - WeekISO=realted(Date Week ISO) and WeekISO-2 =Realated(Date WeekISO)

And tried 

CALCULATE(
DISTINCTCOUNT(Task[DocumentNo]),
FILTER(
Task,
Task[Week ISO]= SELECTEDVALUE(
'Date'[Week_ISO -2]
but it doesnt return result.

 

ivaylodemirev
New Member

I tried 
Sites per Week =
DISTINCTCOUNT(Tasks[DocumentNo])

Sites for 2 Week Ago =
VAR SelectedWeek = SELECTEDVALUE('Date'[Week_ISO])
RETURN
CALCULATE(
DISTINCTCOUNT(Tasks[DocumentNo]),
FILTER(
ALL('Date'),
'Date'[Week_ISO] = SelectedWeek - 2
)
)

but second measure return me blank

Anonymous
Not applicable

Hi @ivaylodemirev ,

 

According to your description, here are my steps you can follow as a solution.

(1) This is my test data.  

vtangjiemsft_0-1682060866264.png

Date = ADDCOLUMNS(CALENDAR(DATE(2022,1,1),DATE(2022,12,31)) ,
"Week_ISO",WEEKNUM([Date],21))

vtangjiemsft_1-1682060893751.png

(2) We can create two measures. 

Sites per Week = 
var _select=SELECTEDVALUE('Date'[Week_ISO])

return
COUNTROWS(FILTER(ALL('Task'),WEEKNUM('Task'[TaskDate],21)=_select))
Sites for 2 Week Ago = 

var _select=SELECTEDVALUE('Date'[Week_ISO])

return
COUNTROWS(FILTER(ALL('Task'),WEEKNUM('Task'[TaskDate],21)+2=_select))

(3) Then the result is as follows.

vtangjiemsft_2-1682060944542.png

 

If the above one can't help you get the desired result, please provide some sample data in your tables (exclude sensitive data) with Text format and your expected result with backend logic and special examples. It is better if you can share a simplified pbix file. Thank you.

 

Best Regards,

Neeko Tang

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

Helpful resources

Announcements
August Power BI Update Carousel

Power BI Monthly Update - August 2025

Check out the August 2025 Power BI update to learn about new features.

August 2025 community update carousel

Fabric Community Update - August 2025

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