Don't miss your chance to take the Fabric Data Engineer (DP-600) exam for FREE! Find out how by attending the DP-600 session on April 23rd (pacific time), live or on-demand.
Learn moreNext up in the FabCon + SQLCon recap series: The roadmap for Microsoft SQL and Maximizing Developer experiences in Fabric. All sessions are available on-demand after the live show. Register now
Hello!
I have used the TOTALMTD and DATESMTD function in my measures but now need to figure out how to filter it to a custom date range for each month. The month's we use dont exactly follow the Calendar month - e.g May starts on Mya 1 but ends June 6. Every month is slightly different too.
The formula is currently as follows:
Hi @Aahil10,
Time intelligence functions not suitable for custom date ranges or field calculations, they are based on the auto-generated hidden calendar.
Auto date/time in Power BI Desktop - Power BI | Microsoft Docs
In my opinion, I'd like to suggest you use the date function manually to filter the custom date range and add the custom field as filter conditions.
If you are confused about the coding formula, please share some dummy data to test.
How to Get Your Question Answered Quickly
Regards,
Xiaoxin Sheng
@Aahil10 , I such case base on start date of period and end date of period create following columns in your date table
Period Rank = RANKX(all('Period'),'Period'[year period],,ASC,Dense)
//OR
Period Rank = RANKX(all('Period'),'Period'[period start date],,ASC,Dense)
Period Day = DATEDIFF('Date'[Period Start Date],'Date'[Date],Day)+1
This Period = CALCULATE(sum('order'[Qty]), FILTER(ALL('Period'),'Period'[Period Rank]=max('Period'[Period Rank])))
Last Period = CALCULATE(sum('order'[Qty]), FILTER(ALL('Period'),'Period'[Period Rank]=max('Period'[Period Rank])-1))
PTD = CALCULATE(sum('order'[Qty]), FILTER(ALL('Date'),'Date'[Period Rank]=max('Date'[Period Rank]) && [Period Day] <=max([Period Day])))
LPTD = CALCULATE(sum('order'[Qty]), FILTER(ALL('Date'),'Date'[Period Rank]=max('Date'[Period Rank])-1 && [Period Day] <=max([Period Day])))
If you have recently started exploring Fabric, we'd love to hear how it's going. Your feedback can help with product improvements.
A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.
Share feedback directly with Fabric product managers, participate in targeted research studies and influence the Fabric roadmap.
| User | Count |
|---|---|
| 44 | |
| 43 | |
| 38 | |
| 18 | |
| 16 |
| User | Count |
|---|---|
| 67 | |
| 63 | |
| 30 | |
| 30 | |
| 23 |