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
mat007mat
Regular Visitor

formulas between different tables

dears,

 

I would like to get help on following issue - I am combining two tables, one with actuals sales and one with forecasted sales. I would like to build the following KPI: I want to sum up all absolut forecast errors (per item type, not on packaging) for a region, and divide that to the actual sales of that region.

 

I hae added two tables below to describe the issue

 

Sales:

 

salessales

 

forecast:

forecastforecast

 

the expected outcome would be :

                       jan       feb

Belgium     44%   33%

 

this is based on the sum of absolute errors (jan: 7+5+19+7) divided by sum of sales (7+7+22) = 44%.

 

please let me know if above would not be clear,

appreciate your help to formulate above kpi in a dax for power pivot

 

thanks

Mat

1 ACCEPTED SOLUTION
Jimmy801
Community Champion
Community Champion

Hello @mat007mat 

 

as you are writing about KPI I assume you need a solution in Power Pivot/DAX. I would prefer combining such tables in Power query and do the final calculation in DAX.

However.. to solve this with DAX I saw no other solution to create a new table out of the forecast-table only using country, type and month. Then adding 3 new columns to calculate forecast, sales and error. the measure uses then sales and error to get the KPI.

Find enclosed the file with my solution

link 


If this post helps or solves your problem, please mark it as solution.
Kudos are nice to - thanks
Have fun

Jimmy

View solution in original post

7 REPLIES 7
Jimmy801
Community Champion
Community Champion

Hello @mat007mat 

were you able to solve the problem with any reply given?

If so, please mark it as solution (to help other users find useful content and to acknowledge the work of users that helped you)
Kudoes are nice too

All the best

Jimmy

v-juanli-msft
Community Support
Community Support

Hi @mat007mat 

Where is the sum of absolute errors coming from?

Is it from the values i circled in blue?

But they doesn't equal to example sum of absolute errors(jan: 7+5+19+7).

Capture9.JPG

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

Dear Maggie,

 

the error was calculated as;

 salesforecastabsolute error
item13+45+97
item27125
item322319
item4077

 

so the KPI would be (7+5+19+7) / (3+4+7+22+0) = 105.5% (and not the 44% that i mistakenly said first - apologies)

 

 

 

Jimmy801
Community Champion
Community Champion

Hello @mat007mat 

 

as you are writing about KPI I assume you need a solution in Power Pivot/DAX. I would prefer combining such tables in Power query and do the final calculation in DAX.

However.. to solve this with DAX I saw no other solution to create a new table out of the forecast-table only using country, type and month. Then adding 3 new columns to calculate forecast, sales and error. the measure uses then sales and error to get the KPI.

Find enclosed the file with my solution

link 


If this post helps or solves your problem, please mark it as solution.
Kudos are nice to - thanks
Have fun

Jimmy

Dear Jimmy,

 

maybe one more question; you worked with the creation of a new table in which you combined data from two other tables.

In power bi I can add this additional table, but can this be done in power pivot as well?  (the creation of a new table only containing formulas?)

 

thanks!

Hello

Don't understand fully your question.
Power pivot can be fed by power query. So you can query a data source, transforming it and hand over to power pivot, if this is what you meant.

All the best

Jimmy

This is great! thanks a lot for your time and effort in this!

 

I have not build it in my tool yet - but I am sure that the described methodology will do.

formulas that I was not aware of, but that are really helpfull are:

 

* summarizecolumns() - great for combining tables

* sumx() with the described filtering - this helps a lot to do the required calc

 

thanks again for your input, and happy new year!

 

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.

Top Solution Authors
Top Kudoed Authors