Replicate AverageX

Hello everyone,

I was confident that I am good at DAX, but sadly I cannot seem to solve this easy problem. I am trying to replicate the calculations shown in the two blocks in the Excel file attached.

The task is simple, I want to calculate MAPE value, and then average it up to a specific level. Sadly I cannot seem to get it to work. I tried using AverageX together with groupby, summarize - nothing worked. :frowning:
Please help .(.xlsx (132.9 KB)

What am I doing wrong? Please help.

Thanks, and have a nice day!

Roberts

Hello, @Roboboboberts !
Please, find in attached file.
What i did:
on the row level of “Region” (when “Region” has value in the table) add classical formula for average:
sum of the volumes in the table column divide number of rows in that column.
using summarize and sumx:
New measure called “MAPE 1”
Please help .(.xlsx (143.8 KB)

=IF(
HASONEVALUE(Table1[Region]);
– check, if on the row level of a table has “Region” values
– if “yes”, just calculates SUM of MAPE values and divide it on ROW Num
SUMX(
SUMMARIZE(‘Table1’;
Table1[Region];
‘Table1’[Market];
‘Table1’[Product];
“MAPE_0”;
‘Table1’[MAPE]);
[MAPE_0]) / COUNTROWS(‘Table1’);
– if “No”, returns automatically calculated MAPE value
‘Table1’[MAPE])

at the total level just auto calculated MAPE value.
Sometimes could face such cases - like described here: Fix Incorrect Totals

Hope, this helps you!

BR,
Oleg

2 Likes

Hi @Roboboboberts

0.39238653 is MAPE value for Baltics, Its not average.

Forecast Acutal MAPE
Baltics 16600 27320 0.39238653

To calculate Average: Create measure like below

Avg:=AVERAGEX(Table1,[MAPE])

image

2 Likes

Hello @Roboboboberts, good to see that you are having progress with your inquiry. Did the response from @Oleg.Poddubnyy and @Rajesh help you solve your inquiry?

If it does, kindly mark as solution the answer that solved your query.

If not, how far did you get and what kind of help you need further?

1 Like

Hello all,

Sorry for the delay in response I did not want to be disrespectful but I just mismanaged my time.

@Oleg.Poddubnyy it works, thanks for the idea.

@Rajesh, thanks for the support but I wanted the measure to be dynamic achieved it with summarize.

Thank you all, and have a nice day!

Roberts

@Roboboboberts

I didn’t understand this. Could you please explain ?