The ultimate Fabric, Power BI, SQL, and AI community-led learning event. Save €200 with code FABCOMM.
Get registeredEnhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends September 15. Request your voucher.
Hello - Simple problem I think, but not having any luck with DATEADD (assuming that is what I need to use).
The values in these visuals are correct values....just one month ahead of where they need to be. In other words, the April data should really be the March data, the March data should be the February data, etc.
This is the current measure I am using. Tried to add DATEADD into but got an error. Any guidance on how to fix would be appreciated!
@Anonymous
Both formula's like this should work with a date calendar
last MTD Sales = CALCULATE(SUM(Sales[Sales Amount]),DATESMTD(dateadd('Date'[Date],-1,MONTH)))
last MTD Sales = CALCULATE(SUM(Sales[Sales Amount]),dateadd('Date'[Date],-1,MONTH))
To get the best of the time intelligence function. Make sure you have a date calendar and it has been marked as the date in model view. Also, join it with the date column of your fact/s. Refer :
https://radacad.com/creating-calendar-table-in-power-bi-using-dax-functions
https://www.archerpoint.com/blog/Posts/creating-date-table-power-bi
https://www.sqlbi.com/articles/creating-a-simple-date-table-in-dax/
Hi Amit, Yes, I always use date tables.
In this case, the data is not coming form a sales table. It is coming from a "snapshot" exported from our ERP system. The snapshot is an aggregated value...in this case for a KPI called "last period" (that is what I have the filter set to).
This filter aggregates to the last period, based on what value you set the "as of date" to. I am using the endofmonth function to grab the last date of each period. The only issue is that the values are mis-matched with the months (values are one month ahead of the dates). The April value should be the March value, March should be Feb, etc.
DATEADD() works over columns, not scalar values. So the following will not work:
DATEADD(
date(2020,1,1),
1,
MONTH
)
The first part of the DATEADD() function needs to be a column of dates. But you didn't show how you were using it or what your error was, so not sure if that is the issue.
How to get good help fast. Help us help you.
How to Get Your Question Answered Quickly
How to provide sample data in the Power BI Forum
DAX is for Analysis. Power Query is for Data Modeling
Proud to be a Super User!
MCSA: BI ReportingI do have a date table. And I think as you pointed out, the scalar value is the issue.
The formula referenced "snapshots" coming out of our ERP system (I hate working with snapshot data!). In any case, there is a filtere applied that is an aggretation done in the ERP system. It is called "All Revenue Last Period".
I use the "endofmonth" function because I want to retrieve the last values of the prior months...these numbers are not regular sales numbers that I could pull from the sales table (as Amit's formula would do). These specific totals have been reconciled by accounting and yes, they are scalar.
Again, the formula derives the correct numbers, just not on the correct months.
Measure 5 = CALCULATE(SUM(Flu_Snapshots[Actual Value]),ENDOFMONTH(Flu_Snapshots[As Of Date]))*-1
User | Count |
---|---|
65 | |
61 | |
60 | |
53 | |
30 |
User | Count |
---|---|
181 | |
88 | |
71 | |
48 | |
46 |