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

Earn the coveted Fabric Analytics Engineer certification. 100% off your exam for a limited time only!

Reply
nhmpp
Helper I
Helper I

Forecasting using average revenue based on product type, location, and weekday

Hello,

 

I am trying to caluclate an average for all future dates based off of past dates this month, with respect to three filters: product type, location name, and weekday. 

 

Here is a sample of what each table looks like:
Calendar:
nhmpp_2-1668027245864.png

Query1:

nhmpp_3-1668027298255.png

 

 

For *one specific product type*, filtering for only the product_type "on demand", here is my layout so far.

nhmpp_0-1668026396296.png

You can see the predictions are working correctly, except that they are not taking into account the weekday! I think this is simply because it is not part of the matrix? I have tried everything I can think of, and this is the measure I am using right now:

 

Forecast =
VAR AvgRev = CALCULATE( AVERAGE(Query1[revenue]), ALLEXCEPT(Query1, Query1[location_name], Query1[product_type], Query1[weekday]))
RETURN
    IF(
        MAX('Calendar'[Date]) < TODAY() ,
        --- THEN ---
        MAX('Query1'[revenue]) ,
        --- ELSE ---
        AvgRev
)
 
I have a calendar table seen earlier which is related on date (many) to Date (one):
nhmpp_1-1668027049573.png
 
The forecast matrix right now uses Date from the calendar table, but is being told to filter with weekday from "Query1", although because of the relationship I would think that shouldn't be an issue. 
 
I would appreciate any help! At the end of this, I will have to get total revenue sums for each location on each product_type. I am not sure if that changes the approach I should use. 
 
Thank you!
1 ACCEPTED SOLUTION
v-xiaosun-msft
Community Support
Community Support

Hi @nhmpp ,

 

According to your description, here is my suggestion.

Please establish a relationship between two tables with "weekday".

vxiaosunmsft_0-1668072649717.png

Then it will work.

vxiaosunmsft_1-1668072695720.png

 

Best Regards,
Community Support Team _ xiaosun

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

1 REPLY 1
v-xiaosun-msft
Community Support
Community Support

Hi @nhmpp ,

 

According to your description, here is my suggestion.

Please establish a relationship between two tables with "weekday".

vxiaosunmsft_0-1668072649717.png

Then it will work.

vxiaosunmsft_1-1668072695720.png

 

Best Regards,
Community Support Team _ xiaosun

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Helpful resources

Announcements
April AMA free

Microsoft Fabric AMA Livestream

Join us Tuesday, April 09, 9:00 – 10:00 AM PST for a live, expert-led Q&A session on all things Microsoft Fabric!

March Fabric Community Update

Fabric Community Update - March 2024

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