Check your eligibility for this 50% exam voucher offer and join us for free live learning sessions to get prepared for Exam DP-700.
Get StartedDon't miss out! 2025 Microsoft Fabric Community Conference, March 31 - April 2, Las Vegas, Nevada. Use code MSCUST for a $150 discount. Prices go up February 11th. Register now.
Hello all,
I have a Date/calender Table. I need two columns. Column1 should show previous month end last Saturday in date format. Column2 should show current month end last Friday date. For example, for row1, if the previous month end last Saturday of April 2024, column1 date should be 27/04/2024 and column2 should show current month end date i.e last Friday date May 31/05/2024.
And for row2 , the column1 date should be immediate +1 of current month last Friday i.e Saturday date 01/06/2024 and column2 should be last Friday of June 28/06/2024. I need to see the difference between these two columns dates. It should repeat though out the date table for all the rows.For above example, row1 difference shows 35 days and row 2 shows difference of 28 days. The required output shown below.
Column1. Column2. Days
Row1. 27/04/2024 31/05/2024 35 days Row2. 01/06/2024 28/06/2024. 28 days
Row3. 29/06/2024. 26/07/2024 28 days
Row4. 28/07/2024. 30/08/2024. 34 dayslease help me with Dax calculated coluns. Appreciate your help in advance.Than
ks
Solved! Go to Solution.
Hi @KK_007
For your question, here is the method I provided:
Date Table = CALENDAR("4/1/2024", "8/31/2024")
Create columns.
First, you need to get weeks.
weekday = WEEKDAY('Date Table'[Date], 2)
Calculate column 1 from column 2.
Column 2 =
CALCULATE(
MAX('Date Table'[Date]),
FILTER(
'Date Table',
MONTH('Date Table'[Date]) =
MONTH(EARLIER('Date Table'[Date]))
&&
'Date Table'[weekday] = 5
)
)
Column 1 =
var currntMonth = MONTH(TODAY())
RETURN
IF(
MONTH('Date Table'[Column 2]) >= currntMonth,
CALCULATE(
SELECTEDVALUE('Date Table'[Column 2]) + 1,
FILTER(
ALL('Date Table'),
MONTH('Date Table'[Column 2])= MONTH(EARLIER('Date Table'[Column 2])) - 1
)
),
BLANK()
)
Craete a viusal.
Regards,
Nono Chen
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Can i have the same solution for past and future dates please.
Hi @KK_007
For your question, here is the method I provided:
Date Table = CALENDAR("4/1/2024", "8/31/2024")
Create columns.
First, you need to get weeks.
weekday = WEEKDAY('Date Table'[Date], 2)
Calculate column 1 from column 2.
Column 2 =
CALCULATE(
MAX('Date Table'[Date]),
FILTER(
'Date Table',
MONTH('Date Table'[Date]) =
MONTH(EARLIER('Date Table'[Date]))
&&
'Date Table'[weekday] = 5
)
)
Column 1 =
var currntMonth = MONTH(TODAY())
RETURN
IF(
MONTH('Date Table'[Column 2]) >= currntMonth,
CALCULATE(
SELECTEDVALUE('Date Table'[Column 2]) + 1,
FILTER(
ALL('Date Table'),
MONTH('Date Table'[Column 2])= MONTH(EARLIER('Date Table'[Column 2])) - 1
)
),
BLANK()
)
Craete a viusal.
Regards,
Nono Chen
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Hi @v-nuoc-msft ,
User | Count |
---|---|
22 | |
14 | |
11 | |
9 | |
6 |
User | Count |
---|---|
23 | |
23 | |
20 | |
15 | |
10 |