Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Enhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.

Reply
devaverma
New Member

Facing issue with DATEADD function

Hi all, I am a beginnering and try to flow previous year cost using DATEADD function. But, I am not getting the desired results.

 

I am sharing the screenshot of the result that I am getting. Please have a look and help me.

 

Thanks

 

devaverma_0-1744139702651.pngdevaverma_1-1744139871361.png



Please let me know if you need more information.

1 ACCEPTED SOLUTION
Ashish_Mathur
Super User
Super User

Hi,

Try this approach

  1. Create a Calendar table with calculated column formulas for Year, Month name and month number
  2. Create a relationship (Many to One and Single) from the Date column of the Fact table to the Date column of the Calendar table
  3. To your visual/filter/slicer, dray Year/Month name from the Calendar table
  4. Write this measure

Measure = calculate([Cost of logistics],previousmonth(calendar[date]))


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/

View solution in original post

6 REPLIES 6
v-karpurapud
Community Support
Community Support

Hi @devaverma 

I hope this information is helpful. Please let me know if you have any further questions or if you'd like to discuss this further. If this answers your question, please Accept it as a solution and give it a 'Kudos' so others can find it easily.

Thank you.

v-karpurapud
Community Support
Community Support

Hi @devaverma 

I wanted to check if you had the opportunity to review the information provided. Please feel free to contact us if you have any further questions. If my response has addressed your query, please accept it as a solution and give a 'Kudos' so other members can easily find it.

Thank you.

v-karpurapud
Community Support
Community Support

Hi @devaverma 

May I ask if you have resolved this issue? If so, please mark the helpful reply and accept it as the solution. This will be helpful for other community members who have similar problems to solve it faster.

Thank you.

v-karpurapud
Community Support
Community Support

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
 

Ashish_Mathur
Super User
Super User

Hi,

Try this approach

  1. Create a Calendar table with calculated column formulas for Year, Month name and month number
  2. Create a relationship (Many to One and Single) from the Date column of the Fact table to the Date column of the Calendar table
  3. To your visual/filter/slicer, dray Year/Month name from the Calendar table
  4. Write this measure

Measure = calculate([Cost of logistics],previousmonth(calendar[date]))


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/
Deku
Super User
Super User

Can you share a picture of the data model please 


Did I answer your question?
Please help by clicking the thumbs up button and mark my post as a solution!

Helpful resources

Announcements
July 2025 community update carousel

Fabric Community Update - July 2025

Find out what's new and trending in the Fabric community.

July PBI25 Carousel

Power BI Monthly Update - July 2025

Check out the July 2025 Power BI update to learn about new features.

Join our Fabric User Panel

Join our Fabric User Panel

This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.

Top Kudoed Authors