Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.
Here's a DAX pattern that I have used in the past to forecast revenue. It worked great but now I'm trying to use the pattern on a different data set where there is not revenue for each day.
Here's the DAX
$ Revenue Forecast = IF( ISBLANK([$ Revenue]), CALCULATE([$ Revenue 30D MA], SAMEPERIODLASTYEAR('Date'[Date]) ), BLANK())
On the other data set the ISBLANK function would remove the Forecast for historical dates. But now since there are historical days without revenue the ISBLANK function is not working for the new data set.
Here's an example below:
As you can see there was no revenue last year on 1/5 or 1/6 so because [$ Revenue] is blank now it calcuates a forecaste amount.
Any ideas? Thanks!!!!
Solved! Go to Solution.
Here's one idea:
$ Revenue Forecast = VAR LastRevenueDate = LASTNONBLANK ( ALL ( 'Date'[Date] ), [$ Revenue] ) RETURN CALCULATE ( CALCULATE ( [$ Revenue 30D MA], SAMEPERIODLASTYEAR ( 'Date'[Date] ) ), KEEPFILTERS ( DATESBETWEEN ( 'Date'[Date], LastRevenueDate + 1, BLANK () ) ) )
The logic is:
'Date' should be marked as date table for this to be a reliable measure (probably already is).
Does this work in your model?
Regards,
Owen
Here's one idea:
$ Revenue Forecast = VAR LastRevenueDate = LASTNONBLANK ( ALL ( 'Date'[Date] ), [$ Revenue] ) RETURN CALCULATE ( CALCULATE ( [$ Revenue 30D MA], SAMEPERIODLASTYEAR ( 'Date'[Date] ) ), KEEPFILTERS ( DATESBETWEEN ( 'Date'[Date], LastRevenueDate + 1, BLANK () ) ) )
The logic is:
'Date' should be marked as date table for this to be a reliable measure (probably already is).
Does this work in your model?
Regards,
Owen
Works Perfectly, Thanks Owen!!!
Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City
Check out the April 2024 Power BI update to learn about new features.
User | Count |
---|---|
107 | |
93 | |
77 | |
65 | |
53 |
User | Count |
---|---|
147 | |
106 | |
104 | |
87 | |
61 |