Forum Discussion
Facing issue with DATEADD function
- 1 year ago
Hi,
Try this approach
- Create a Calendar table with calculated column formulas for Year, Month name and month number
- Create a relationship (Many to One and Single) from the Date column of the Fact table to the Date column of the Calendar table
- To your visual/filter/slicer, dray Year/Month name from the Calendar table
- Write this measure
Measure = calculate([Cost of logistics],previousmonth(calendar[date]))
Hi devaverma
Thank you for reaching out to the Microsoft Fabric Community Forum.
The issue you're encountering with the DATEADD function is most likely related to the absence of a proper date table. For DATEADD to work correctly, it requires a continuous date table with no missing dates. Additionally, the order_date field you are using 'data dimensions'[order_date] must come from a marked date table within your data model.
If your date table is not properly linked to the fact table or if there are any gaps in the order_date values, the DATEADD function may return blank or unexpected results.
As suggested by Ashish_Mathur , try creating a calendar table and marked it as the official date table. Make sure this calendar is related to fact table through the order_date field.
If the issue still persists after implementing the calendar table, kindly share the PBIX file so we can investigate further and assist you more effectively.
If my response has resolved your query, please mark it as the Accepted Solution to assist others. Additionally, a 'Kudos' would be appreciated if you found my response helpful.
Thank You