Forum Discussion
Date Periods MTD Automation DAX not working properly
Hi mclawler ,
According to your description, I create a sample.
PwBi OpenClose table:
Here's my solution.
1.Create a new date table, mark this table as date table.
Date =
FILTER ( 'PwBi OpenClose', 'PwBi OpenClose'[FundedDate] <= TODAY () )
2. Create another table.
Date Periods =
UNION (
ADDCOLUMNS ( DATESMTD ( 'Date'[FundedDate] ), "Type", "MTD", "Order", 1 ),
ADDCOLUMNS ( DATESQTD ( 'Date'[FundedDate] ), "Type", "QTD", "Order", 2 ),
ADDCOLUMNS ( DATESYTD ( 'Date'[FundedDate] ), "Type", "YTD", "Order", 3 ),
ADDCOLUMNS (
PREVIOUSMONTH ( DATESMTD ( 'Date'[FundedDate] ) ),
"Type", "Last Month",
"Order", 4
),
ADDCOLUMNS (
PREVIOUSQUARTER ( DATESQTD ( 'Date'[FundedDate] ) ),
"Type", "Last QTR",
"Order", 5
),
ADDCOLUMNS (
PREVIOUSYEAR ( DATESYTD ( 'Date'[FundedDate] ) ),
"Type", "Last Year",
"Order", 6
),
ADDCOLUMNS (
DATESINPERIOD ( 'Date'[FundedDate], TODAY () - 30, 30, DAY ),
"Type", "Last 30 Days",
"Order", 7
),
ADDCOLUMNS (
DATESINPERIOD ( 'Date'[FundedDate], TODAY () - 90, 90, DAY ),
"Type", "Last 90 Days",
"Order", 8
),
ADDCOLUMNS (
DATESINPERIOD ( 'Date'[FundedDate], EOMONTH ( TODAY (), -1 ), -13, MONTH ),
"Type", "Lookback 1 Year",
"Order", 9
),
ADDCOLUMNS (
CALENDAR ( MIN ( 'Date'[FundedDate] ), MAX ( 'Date'[FundedDate] ) ),
"Type", "Custom",
"Order", 10
),
ADDCOLUMNS (
DATESINPERIOD ( 'Date'[FundedDate], EOMONTH ( TODAY (), -1 ), -3, MONTH ),
"Type", "Last 3 Months",
"Order", 11
),
ADDCOLUMNS (
DATESINPERIOD ( 'Date'[FundedDate], EOMONTH ( TODAY (), -1 ), -9, MONTH ),
"Type", "Last 9 Months",
"Order", 12
)
)
Get the correct result:
I attach my sample below for your reference.
Best regards,
Community Support Team_yanjiang
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
I thnk that would normally work, but unfortunately we don't fund a loan every single day and sometimes we do multiple per day, so PBI won't allow me to mark the table as a Date Table:
- v-yanjiang-msft3 years ago
Community Support
Hi mclawler ,
Please see my attached pbix, it also works even though don't mark as date table.
Best regards,
Community Support Team_yanjiang
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.