The ultimate Fabric, Power BI, SQL, and AI community-led learning event. Save €200 with code FABCOMM.
Get registeredEnhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends September 15. Request your voucher.
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.
Solved! Go to Solution.
Hi @ivaylodemirev ,
According to your description, here are my steps you can follow as a solution.
(1) This is my test data.
Date = ADDCOLUMNS(CALENDAR(DATE(2022,1,1),DATE(2022,12,31)) ,
"Week_ISO",WEEKNUM([Date],21))
(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.
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.
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.
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
Hi @ivaylodemirev ,
According to your description, here are my steps you can follow as a solution.
(1) This is my test data.
Date = ADDCOLUMNS(CALENDAR(DATE(2022,1,1),DATE(2022,12,31)) ,
"Week_ISO",WEEKNUM([Date],21))
(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.
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.
User | Count |
---|---|
14 | |
11 | |
8 | |
6 | |
5 |
User | Count |
---|---|
28 | |
19 | |
14 | |
8 | |
5 |