March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount! Early bird discount ends December 31.
Register NowBe one of the first to start using Fabric Databases. View on-demand sessions with database experts and the Microsoft product team to learn just how easy it is to get started. Watch now
Hi all,
Trying to achieve the following output for each month in Power BI.
Date | Day |
01 December 2021 | 1 |
02 December 2021 | 2 |
03 December 2021 | 3 |
04 December 2021 | 3 |
05 December 2021 | 3 |
06 December 2021 | 4 |
07 December 2021 | 5 |
08 December 2021 | 6 |
09 December 2021 | 7 |
10 December 2021 | 8 |
11 December 2021 | 8 |
12 December 2021 | 8 |
13 December 2021 | 9 |
14 December 2021 | 10 |
15 December 2021 | 11 |
16 December 2021 | 12 |
17 December 2021 | 13 |
18 December 2021 | 13 |
19 December 2021 | 13 |
20 December 2021 | 14 |
21 December 2021 | 15 |
22 December 2021 | 16 |
23 December 2021 | 17 |
24 December 2021 | 18 |
25 December 2021 | 18 |
26 December 2021 | 18 |
27 December 2021 | 19 |
28 December 2021 | 20 |
29 December 2021 | 21 |
30 December 2021 | 22 |
31 December 2021 | 23 |
01 January 2022 | 23 |
02 January 2022 | 23 |
03 January 2022 | 1 |
04 January 2022 | 2 |
05 January 2022 | 3 |
06 January 2022 | 4 |
Kindly help with the above.
Thank You!
Solved! Go to Solution.
@liberty20
I created a calculated column to get the desired results, please check and let me know if it works for you. I have attached a PBIX file below.
VAR __DATE1 =
COUNTROWS(
FILTER(
DATESMTD('Dates'[Date]),
WEEKDAY( 'Dates'[Date] , 2) in {1,2,3,4,5}
)
)
VAR __DATE2 =
COUNTROWS(
FILTER(
PARALLELPERIOD('Dates'[Date], -1 ,MONTH),
WEEKDAY( 'Dates'[Date] , 2) in {1,2,3,4,5}
)
)
RETURN
COALESCE( __DATE1, __DATE2)
⭕ Subscribe and learn Power BI from these videos
⚪ Website ⚪ LinkedIn ⚪ PBI User Group
@liberty20
I created a calculated column to get the desired results, please check and let me know if it works for you. I have attached a PBIX file below.
VAR __DATE1 =
COUNTROWS(
FILTER(
DATESMTD('Dates'[Date]),
WEEKDAY( 'Dates'[Date] , 2) in {1,2,3,4,5}
)
)
VAR __DATE2 =
COUNTROWS(
FILTER(
PARALLELPERIOD('Dates'[Date], -1 ,MONTH),
WEEKDAY( 'Dates'[Date] , 2) in {1,2,3,4,5}
)
)
RETURN
COALESCE( __DATE1, __DATE2)
⭕ Subscribe and learn Power BI from these videos
⚪ Website ⚪ LinkedIn ⚪ PBI User Group
Can you provide more details on the following
1. What's the logic when a new month starts?
2. What if the 1st date in the table starts on Saturday? Should you start with 1,1,2 ?
3. Are looking for a DAX Calc column or a measure?
⭕ Subscribe and learn Power BI from these videos
⚪ Website ⚪ LinkedIn ⚪ PBI User Group
March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!
Your insights matter. That’s why we created a quick survey to learn about your experience finding answers to technical questions.
Arun Ulag shares exciting details about the Microsoft Fabric Conference 2025, which will be held in Las Vegas, NV.
User | Count |
---|---|
7 | |
3 | |
2 | |
1 | |
1 |
User | Count |
---|---|
8 | |
3 | |
2 | |
2 | |
2 |