Forum Discussion
Creating measures based on different deadline dates
Hi PaisleyPrince ,
Thanks for sharing the additional details and the screenshot.
The issue appears to come from deriving the month inside the measure using the deadline date. When Month is placed on the visual, the month calculated from the deadline date overrides the month coming from the Date table, which leads to incorrect results when splitting the values by month.
To avoid this, the month should always come from the Date table. The department deadline should be used only as a cutoff day within the selected month, not to determine the month itself.
One approach is to take the year and month from the Date table and then construct the deadline date for each department within that month before comparing it with the invoice posting date.
A measure pattern would look like this:
Invoices Posted =
VAR SelectedYear =
YEAR ( MIN ( 'Date'[Date] ) )
VAR SelectedMonth =
MONTH ( MIN ( 'Date'[Date] ) )
VAR DeadlineDay =
MAX ( Division_DM[Deadline Day] )
VAR DeadlineDate =
DATE ( SelectedYear, SelectedMonth, DeadlineDay )
RETURN
CALCULATE (
COUNTROWS ( Invoices ),
Invoices[PostedDate] <= DeadlineDate
)
If this still does not behave as expected in your model, please share a sample PBIX file or sample data. That will help in understanding the setup better and providing more targeted guidance.
You could upload your file to a cloud storage (like OneDrive, Dropbox, Google Drive or Wetransfer for example) and paste the link here.
How to provide sample data in the Power BI Forum - Microsoft Fabric Community
Thank you.
Hi PaisleyPrince ,
Just wanted to check if the response provided was helpful. If further assistance is needed, please reach out and could you please share sample data or PBIX file for better guidance. You could upload your file to a cloud storage (like OneDrive, Dropbox, Google Drive or Wetransfer for example) and paste the link here.
How to provide sample data in the Power BI Forum - Microsoft Fabric Community
Thank you.