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

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.

Reply
jwininger
Regular Visitor

Computation Error in DAX

I am working on a forecasting dashboard for my business.  Basically I take 5 week trend, 13 week trend, YTD trend, and last years trend and get a weighted trend.  I then take that weighted trend * units sold for the next 13 weeks from last years sales.  The issue is DAX is not computig it correctly.  See below.

 

Results of computation:

trend.png

Formula to calculate forecast:

formula.png

Thanks in advance.

 

Justin

3 REPLIES 3
v-lid-msft
Community Support
Community Support

Hi @jwininger ,


How about the result after you follow the suggestions mentioned in my original post?Could you please provide more details about it If it doesn't meet your requirement?

 

Best regards,

Community Support Team _ Dong Li
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Community Support Team _ Dong Li
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
v-lid-msft
Community Support
Community Support

Hi @jwininger ,

 

We can try to use the following formula to meet your requirement

 

 

13WeekForecasr =
VAR d =
    MAX ( 'Calendar'[Date] )
VAR ld =
    DATE ( YEAR ( d ) - 1, MONTH ( d ), DAY ( d ) )
RETURN
    CALCULATE (
        [Net Sales],
        FILTER ( ALL ( 'Calendar' ), AND ( [Date] >= ld, [Date] <= ld + 13 * 7 ) )
    )
        * CALCULATE (
            [Weighted Trend],
            FILTER ( ALL ( 'Calendar' ), AND ( [Date] >= ld, [Date] <= ld + 13 * 7 ) )
        )

 

 


If it doesn't meet your requirement, kindly share your sample data and expected result to me if you don't have any Confidential Information. Please upload your files to One Drive and share the link here.

 

Best regards,

Community Support Team _ Dong Li
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Community Support Team _ Dong Li
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
amitchandak
Super User
Super User

The information you have provided is not making the problem clear to me. Can you please explain with an example. If possible please share a sample pbix file after removing sensitive information.

 

Can you, also provide the formula that you wanted not the DAX expression.
Thanks

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

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