cancel
Showing results for
Did you mean:

Find everything you need to get certified on Fabric—skills challenges, live sessions, exam prep, role guidance, and more. Get started

Frequent Visitor

## Measure to calculate Total Forecast by Each Country

 Date Country Forecast 17/04/2023 France 2830 18/04/2023 France 2758 19/04/2023 France 2938 20/04/2023 France 3033 21/04/2023 France 2905 22/04/2023 France 2760 23/04/2023 France 2486 17/04/2023 Netherlands 418 18/04/2023 Netherlands 489 19/04/2023 Netherlands 500 20/04/2023 Netherlands 569 21/04/2023 Netherlands 586 22/04/2023 Netherlands 580 23/04/2023 Netherlands 573 17/04/2023 Denmark 28 18/04/2023 Denmark 47 19/04/2023 Denmark 34 20/04/2023 Denmark 35 21/04/2023 Denmark 36 22/04/2023 Denmark 34 23/04/2023 Denmark 27 17/04/2023 Sweden 128 18/04/2023 Sweden 164 19/04/2023 Sweden 199 20/04/2023 Sweden 187 21/04/2023 Sweden 169 22/04/2023 Sweden 170 23/04/2023 Sweden 164 17/04/2023 Germany 1064 18/04/2023 Germany 1258 19/04/2023 Germany 1310 20/04/2023 Germany 1330 21/04/2023 Germany 1266 22/04/2023 Germany 1217 23/04/2023 Germany 1092 17/04/2023 Spain 33 18/04/2023 Spain 37 19/04/2023 Spain 52 20/04/2023 Spain 50 21/04/2023 Spain 38 22/04/2023 Spain 45 23/04/2023 Spain 35 17/04/2023 Italy 48 18/04/2023 Italy 53 19/04/2023 Italy 61 20/04/2023 Italy 67 21/04/2023 Italy 67 22/04/2023 Italy 68 23/04/2023 Italy 59 17/04/2023 Other 296 18/04/2023 Other 365 19/04/2023 Other 388 20/04/2023 Other 395 21/04/2023 Other 369 22/04/2023 Other 364 23/04/2023 Other 297

Hi

How do I write a Meausre that will Calculate the Total Forecast by Each Country?

I am Close but I can't get the filtering right. This is what I have so far.

Total Forecast = CALCULATE(SUM('Boohoo Forecast'[Forecast]), ALL('Boohoo Forecast'[Country]))

The result is This which is the total for all the countries combined rather than each country.

Any help would be appreciated.

1 ACCEPTED SOLUTION
Community Support

Hi @Enrico501 ,

By default, if you put Country and Forecast columns in one visual and select Sum of Forecast, it will automatically sum the values based on each country, this is called "context" in Power BI.

If you prefer a measure, here's the solution:

``````Measure =
SUMX (
FILTER ( ALL ( 'Table' ), 'Table'[Country] = MAX ( 'Table'[Country] ) ),
'Table'[Forecast]
)
``````

I attach my sample below for your reference.

Best regards,

Community Support Team_yanjiang

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

3 REPLIES 3
Community Support

Hi @Enrico501 ,

By default, if you put Country and Forecast columns in one visual and select Sum of Forecast, it will automatically sum the values based on each country, this is called "context" in Power BI.

If you prefer a measure, here's the solution:

``````Measure =
SUMX (
FILTER ( ALL ( 'Table' ), 'Table'[Country] = MAX ( 'Table'[Country] ) ),
'Table'[Forecast]
)
``````

I attach my sample below for your reference.

Best regards,

Community Support Team_yanjiang

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

Regular Visitor
``Total Forecast = SUM('Boohoo Forecast'[Forecast])``

or

``Total Forecast = CALCULATE(SUM('Boohoo Forecast'[Forecast]))``

Frequent Visitor

That totals the Forecast in total. It does not split it out in country. I need it to  Calculate the totals but Country

Announcements

#### Europe’s largest Microsoft Fabric Community Conference

Join the community in Stockholm for expert Microsoft Fabric learning including a very exciting keynote from Arun Ulag, Corporate Vice President, Azure Data.

#### Power BI Monthly Update - August 2024

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

#### Fabric Community Update - August 2024

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

Top Solution Authors
Top Kudoed Authors