Seasonally adjusted government deficit at 3.2% of GDP in the euro area and 3.0% in the EU (2024)

Euro indicators 22 July 2024 Next release: 22 October 2024

First quarter of 2024

Skip to the content

Before printing

Printing can have negative environmental impacts due to paper waste. We encourage you to explore eco-friendly alternatives. Bookmarking this page in your browser allows you to access it anytime.

This publication can also be converted to PDF, if you have a PDF printer installed on your computer. PDF printers function as virtual printers, enabling you to create digital copies of web pages and access the content offline.

Euro area and EU deficits decrease compared to the fourth quarter of 2023

Overview

In the first quarter of 2024, the seasonally adjusted general government deficit to GDP ratio stood at 3.2% in the euro area (EA20) and 3.0% in the EU. In the first quarter of 2024, the euro area and EU deficit to GDP ratios decreased compared to 4.0% and 3.9% in the fourth quarter of 2023.

These data are released by Eurostat, the statistical office of the European Union.

Seasonally adjusted* government revenue, expenditure and surplus (+) / deficit (-)
in the euro area and EU (% of GDP)

(% of GDP)

2022Q1

2022Q2

2022Q3

2022Q4

2023Q1

2023Q2

2023Q3

2023Q4

2024Q1p

Euro area

surplus (+) / deficit (-)

-2.9

-2.6

-3.9

-5.2

-3.3

-3.5

-3.5

-4.0

-3.2

total revenue

47.1

47.1

46.9

46.5

46.3

46.2

46.5

46.7

46.2

total expenditure

50.0

49.6

50.8

51.7

49.6

49.7

50.0

50.7

49.4

EU

surplus (+) / deficit (-)

-2.6

-2.3

-3.7

-4.8

-3.1

-3.4

-3.5

-3.9

-3.0

total revenue

46.6

46.5

46.2

45.9

45.6

45.7

46.0

46.2

45.9

total expenditure

49.2

48.8

49.9

50.8

48.7

49.1

49.5

50.1

48.9

p: provisional data

* Calendar day and seasonally adjusted

Data are a combination of national and Eurostat estimates.

Seasonally adjusted government deficit at 3.2% of GDP in the euro area and 3.0% in the EU (1)

Seasonally adjusted government revenue and expenditure for the euro area and EU

In the first quarter of 2024, government total revenue in the euro area amounted to 46.2% of GDP. The decrease compared with 46.7% in the fourth quarter of 2023 was mainly due to a slight decrease in seasonally adjusted government total revenue in absolute terms as well as an increase in nominal GDP. In absolute terms, seasonally adjusted total revenue in the euro area decreased by around - €2 billion compared with the fourth quarter of 2023. Government total expenditure in the euro area stood at 49.4% of GDP, a decrease in the ratio compared with 50.7% in the previous quarter, due to a decrease in seasonally adjusted total government expenditure by around - €31 billion as well as an increase in GDP.

In the EU, government total revenue was 45.9% of GDP in the first quarter of 2024 compared with 46.2% in the previous quarter. Seasonally adjusted total revenue in the EU increased by around €9 billion compared with the fourth quarter of 2023. Government total expenditure in the EU was 48.9% of GDP, a decrease compared with 50.1% of GDP in the previous quarter. Seasonally adjusted total expenditure decreased by around - €29 billion compared with the previous quarter.

Seasonally adjusted government deficit at 3.2% of GDP in the euro area and 3.0% in the EU (2)

Tables

Seasonally adjusted* general government surplus (+) / deficit (-)

% of GDP

2022Q1

2022Q2

2022Q3

2022Q4

2023Q1

2023Q2

2023Q3

2023Q4

2024Q1p

Euro area

-2.9

-2.6

-3.9

-5.2

-3.3

-3.5

-3.5

-4.0

-3.2

EU

-2.6

-2.3

-3.7

-4.8

-3.1

-3.4

-3.5

-3.9

-3.0

Belgium

-2.2

-4.2

-4.5

-3.4

-4.1

-4.1

-4.4

-5.2

-4.5

Bulgaria

-3.4

-3.4

-5.3

0.5

-2.8

-3.6

-5.3

3.5

-5.6

Czechia

-2.1

-2.5

-4.4

-3.3

-4.1

-3.4

-3.5

-3.2

-2.0

Denmark

3.1

3.5

3.3

3.6

4.1

3.6

3.4

2.6

3.8

Germany

-1.0

-1.1

-2.4

-5.4

-2.5

-2.8

-1.8

-2.5

-2.8

Estonia

-1.2

0.3

-0.7

-2.2

-2.5

-1.8

-2.8

-6.9

-2.3

Ireland

1.2

1.5

2.8

0.8

1.8

1.6

1.5

1.2

1.6

Greece

:

:

:

:

:

:

:

:

:

Spain

-3.5

-4.6

-4.9

-5.9

-2.7

-4.6

-4.0

-3.2

-3.2

France

-4.9

-3.5

-4.7

-5.8

-5.1

-5.2

-5.6

-5.9

-5.6

Croatia

1.2

0.8

0.1

-0.9

-0.4

-0.3

0.1

-1.9

-1.0

Italy

:

:

:

:

:

:

:

:

:

Cyprus

:

:

:

:

:

:

:

:

:

Latvia

-4.0

-4.8

-3.1

-5.6

-3.2

-0.3

-3.9

-1.9

-1.9

Lithuania

0.7

0.5

-0.8

-2.8

-1.8

-0.3

0.1

-1.3

0.1

Luxembourg

1.2

-0.1

-0.6

-1.5

-1.4

-0.8

-1.0

-1.6

-0.1

Hungary

-3.9

-4.3

-7.3

-9.1

-10.1

-5.6

-5.3

-5.9

-6.0

Malta***

-6.8

-3.6

-5.1

-5.4

-3.7

-3.6

-2.7

-7.2

-1.4

Netherlands

0.2

1.1

-1.0

-0.7

-0.8

-0.5

-0.3

0.0

-0.4

Austria

-3.3

0.0

-5.2

-4.5

-1.6

-1.7

-5.0

-2.3

-2.0

Poland

-1.1

-2.0

-3.3

-6.1

-2.6

-4.6

-6.5

-6.1

-1.8

Portugal

0.4

2.7

1.4

-5.5

2.1

2.0

2.4

-1.6

0.6

Romania

-7.0

-4.2

-7.4

-6.7

-6.6

-6.9

-6.7

-6.5

-7.0

Slovenia

-2.3

-3.2

-3.2

-3.1

-2.7

-2.1

-2.7

-1.2

-2.1

Slovakia

-2.0

-1.4

-1.3

-2.0

-4.6

-3.8

-4.2

-6.9

-5.0

Finland***

-2.1

:

:

-0.8

-2.0

-3.3

-2.7

-3.4

-3.7

Sweden

1.0

2.5

0.7

0.0

-0.1

-0.9

-0.4

-0.8

-0.5

Iceland**

-1.7

-2.2

-4.0

-7.6

-3.3

-2.9

-1.6

-1.3

-0.9

Switzerland

1.0

1.2

1.3

1.4

0.5

0.5

0.5

0.5

1.4

p: provisional data

* Calendar and seasonally adjusted. EU and euro area data are a combination of national and Eurostat estimates.

** Seasonally adjusted GDP used for the denominator

*** See country metadata notes

: Confidential or Eurostat estimate

Source dataset: gov_10q_ggnfa

Seasonally adjusted government deficit at 3.2% of GDP in the euro area and 3.0% in the EU (3)

Seasonally adjusted* general government surplus (+) / deficit (-)

Change on the previous quarter in percentage points of GDP

2022Q2

2022Q3

2022Q4

2023Q1

2023Q2

2023Q3

2023Q4

2024Q1p

Euro area

0.3

-1.3

-1.3

1.9

-0.2

0.0

-0.5

0.8

EU

0.3

-1.4

-1.2

1.7

-0.3

-0.1

-0.4

0.9

Belgium

-1.9

-0.3

1.0

-0.7

0.0

-0.3

-0.9

0.7

Bulgaria

0.0

-1.8

5.8

-3.4

-0.8

-1.7

8.8

-9.1

Czechia

-0.4

-1.8

1.1

-0.8

0.7

-0.1

0.2

1.3

Denmark

0.5

-0.2

0.3

0.4

-0.5

-0.1

-0.8

1.2

Germany

-0.2

-1.3

-2.9

2.9

-0.2

0.9

-0.7

-0.2

Estonia

1.5

-1.0

-1.5

-0.3

0.7

-1.0

-4.1

4.5

Ireland

0.4

1.3

-2.0

1.1

-0.2

-0.1

-0.3

0.5

Greece

:

:

:

:

:

:

:

:

Spain

-1.1

-0.4

-1.0

3.1

-1.9

0.7

0.8

-0.1

France

1.4

-1.2

-1.1

0.7

-0.1

-0.4

-0.3

0.3

Croatia

-0.4

-0.7

-1.0

0.5

0.1

0.4

-2.0

0.8

Italy

:

:

:

:

:

:

:

:

Cyprus

:

:

:

:

:

:

:

:

Latvia

-0.8

1.7

-2.5

2.5

2.9

-3.6

2.0

0.0

Lithuania

-0.1

-1.3

-2.0

1.0

1.4

0.4

-1.3

1.4

Luxembourg

-1.3

-0.5

-0.9

0.1

0.6

-0.3

-0.6

1.5

Hungary

-0.4

-3.1

-1.7

-1.0

4.5

0.3

-0.6

0.0

Malta***

3.2

-1.5

-0.3

1.7

0.1

0.9

-4.6

5.8

Netherlands

0.9

-2.1

0.2

-0.1

0.4

0.1

0.3

-0.4

Austria

3.3

-5.2

0.7

2.9

0.0

-3.3

2.6

0.4

Poland

-0.9

-1.3

-2.8

3.5

-2.1

-1.9

0.5

4.3

Portugal

2.3

-1.2

-6.9

7.6

-0.1

0.4

-4.0

2.2

Romania

2.9

-3.3

0.7

0.2

-0.3

0.2

0.2

-0.5

Slovenia

-0.9

0.0

0.0

0.4

0.5

-0.6

1.5

-0.9

Slovakia

0.6

0.1

-0.7

-2.6

0.8

-0.4

-2.8

1.9

Finland***

:

:

:

-1.2

-1.3

0.6

-0.7

-0.3

Sweden

1.5

-1.8

-0.7

-0.1

-0.8

0.5

-0.4

0.4

Iceland**

-0.4

-1.8

-3.7

4.3

0.4

1.3

0.3

0.4

Switzerland

0.2

0.1

0.1

-0.8

0.0

0.0

0.0

0.8

p: provisional data

* Calendar and seasonally adjusted. EU and euro area data are a combination of national and Eurostat estimates.

** Seasonally adjusted GDP used for the denominator

*** See country metadata notes

: Confidential or Eurostat estimate

Source dataset: gov_10q_ggnfa

Seasonally adjusted government deficit at 3.2% of GDP in the euro area and 3.0% in the EU (4)

Non-seasonally adjusted general government surplus (+) / deficit (-)

% of GDP

2022Q1

2022Q2

2022Q3

2022Q4

2023Q1

2023Q2

2023Q3

2023Q4

2024Q1p

Euro area

-3.9

-2.3

-3.8

-4.5

-4.3

-3.3

-3.4

-3.3

-4.1

EU

-3.5

-1.7

-3.4

-4.7

-4.0

-2.9

-3.3

-3.7

-3.8

Belgium

-7.0

0.1

-7.9

0.0

-8.4

0.5

-7.9

-2.3

-9.6

Bulgaria

-1.8

-1.5

-1.6

-6.0

-1.4

-1.7

-2.0

-2.3

-3.9

Czechia

-4.0

0.1

-3.1

-5.3

-6.1

-0.5

-2.2

-5.4

-3.2

Denmark

3.3

4.3

3.4

2.8

4.3

4.2

3.9

1.0

4.0

Germany

-0.6

0.1

-3.3

-5.9

-2.2

-1.6

-2.8

-3.0

-2.4

Estonia

-3.2

2.2

0.0

-3.0

-4.4

0.2

-2.1

-7.5

-4.2

Ireland

-0.3

1.2

1.4

3.8

0.5

1.2

-0.1

4.5

0.4

Greece

-9.4

1.4

-2.2

-0.5

-10.0

1.4

2.3

-1.2

-5.1

Spain

-1.9

-8.5

2.5

-10.3

-1.0

-8.8

2.3

-6.7

-1.7

France

-7.0

-4.3

-6.1

-1.8

-6.6

-6.1

-7.0

-2.4

-6.9

Croatia

-0.2

2.6

4.6

-7.2

-1.1

0.9

4.5

-8.3

-1.4

Italy

-12.0

-6.2

-9.7

-6.7

-11.6

-5.5

-7.1

-5.7

-8.8

Cyprus

4.0

-4.5

10.5

0.4

5.4

-4.3

10.3

0.6

8.0

Latvia

-1.9

-1.9

-0.4

-13.5

-1.0

3.2

-1.5

-9.0

0.4

Lithuania

0.6

4.6

0.5

-7.6

-1.4

4.1

1.0

-6.8

-0.7

Luxembourg

2.0

2.5

-1.1

-4.6

-0.4

1.9

-1.5

-4.8

1.2

Hungary

-3.0

-1.6

-5.6

-13.2

-10.8

-3.0

-3.6

-9.7

-6.2

Malta***

-8.8

-2.0

-4.0

-7.6

-5.5

-0.5

-1.6

-12.1

-1.2

Netherlands

2.7

1.2

-2.8

-1.2

1.1

0.0

-2.2

-0.3

1.1

Austria

-5.8

0.3

-3.2

-4.5

-4.3

-1.4

-2.4

-2.6

-5.3

Poland

0.4

-0.7

-2.6

-9.5

-0.9

-3.5

-5.4

-9.8

-0.3

Portugal

-0.6

1.4

6.6

-8.5

1.1

0.7

7.7

-4.7

-0.2

Romania

-9.0

-2.3

-5.4

-8.6

-8.5

-4.9

-4.9

-8.3

-9.2

Slovenia

-3.0

-3.9

-1.0

-4.1

-3.1

-3.0

-1.2

-2.6

-2.0

Slovakia

-1.3

-0.8

0.0

-4.5

-3.8

-3.0

-2.3

-10.1

-4.3

Finland***

-1.2

:

:

-1.1

-1.2

-0.4

-5.7

-4.2

-3.2

Sweden

0.3

5.4

0.7

-2.1

-0.9

1.9

-0.3

-2.9

-1.3

Iceland

-0.5

-4.0

-4.9

-6.1

-2.2

-4.7

-1.8

0.6

0.1

Norway

23.5

26.0

31.2

20.9

22.8

19.6

11.6

11.8

14.9

Switzerland

1.0

1.2

1.3

1.3

0.5

0.5

0.5

0.5

1.4

p: provisional data

*** See country metadata notes

Source dataset: gov_10q_ggnfa

Seasonally adjusted government deficit at 3.2% of GDP in the euro area and 3.0% in the EU (5)

Non-seasonally adjusted general government surplus (+) / deficit (-)

Change on the previous year's quarter in percentage points of GDP

2023Q1

2023Q2

2023Q3

2023Q4

2024Q1p

Euro area

-0.3

-1.0

0.4

1.2

0.2

EU

-0.5

-1.2

0.2

1.0

0.2

Belgium

-1.4

0.4

-0.1

-2.3

-1.2

Bulgaria

0.4

-0.2

-0.4

3.7

-2.6

Czechia

-2.1

-0.6

0.9

-0.1

2.9

Denmark

1.0

-0.1

0.4

-1.8

-0.2

Germany

-1.6

-1.7

0.5

3.0

-0.2

Estonia

-1.2

-2.0

-2.1

-4.5

0.2

Ireland

0.8

0.0

-1.4

0.7

-0.1

Greece

-0.7

0.0

4.5

-0.7

4.9

Spain

0.9

-0.3

-0.1

3.6

-0.6

France

0.4

-1.8

-0.8

-0.6

-0.3

Croatia

-0.9

-1.7

-0.1

-1.1

-0.3

Italy

0.4

0.7

2.6

1.0

2.8

Cyprus

1.3

0.2

-0.1

0.2

2.6

Latvia

1.0

5.0

-1.1

4.4

1.4

Lithuania

-2.0

-0.5

0.5

0.8

0.7

Luxembourg

-2.4

-0.7

-0.4

-0.2

1.5

Hungary

-7.8

-1.4

2.0

3.5

4.6

Malta***

3.4

1.5

2.4

-4.5

4.3

Netherlands

-1.6

-1.2

0.6

0.9

0.0

Austria

1.4

-1.7

0.8

2.0

-1.0

Poland

-1.3

-2.8

-2.8

-0.3

0.6

Portugal

1.7

-0.7

1.1

3.8

-1.3

Romania

0.5

-2.6

0.5

0.3

-0.7

Slovenia

-0.2

0.9

-0.2

1.6

1.1

Slovakia

-2.6

-2.2

-2.3

-5.7

-0.5

Finland***

0.0

:

:

-3.1

-2.0

Sweden

-1.2

-3.5

-1.0

-0.8

-0.3

Iceland

-1.7

-0.7

3.1

6.7

2.3

Norway

-0.7

-6.4

-19.5

-9.1

-7.8

Switzerland

-0.5

-0.6

-0.8

-0.8

0.8

*** See country metadata notes

p: provisional data

Source dataset: gov_10q_ggnfa

Seasonally adjusted government deficit at 3.2% of GDP in the euro area and 3.0% in the EU (6)

Notes for users

Methods and definitions

Data for the euro area and EU aggregates are calendar and seasonally adjusted by Eurostat using an indirect approach (bycountry) for total revenue and total expenditure. Both revenue and expenditure exhibit a clear seasonal pattern. The surplus (+) / deficit (-) is derived indirectly from the above-mentioned transactions. For the ratios to GDP, calendar and seasonally adjusted GDP data are used. Most countries supply Eurostat with their own estimates of calendar and seasonally adjusted data for general government total revenue and total expenditure on a voluntary basis and permit Eurostat to publish these estimates.

Detailed metadata on seasonal adjustment are available in Statistics Explained.

Quarterly non-financial accounts for general government use concepts that are in line with the methodology laid out in the European System of Accounts (ESA 2010) as well as the concept of general government deficit/surplus used in the context of the Excessive Deficit Procedure (EDP). Annual EDP data, last published in April 2024, are the subject of a thorough verification by Eurostat.

Quarterly data on GDP are the most recent ones transmitted by EU Member States. While non-seasonally adjusted quarterly government deficit/surplus figures are consistent with annual figures with the exception of differences due to data updates, differences between the sum of quarterly non-seasonally adjusted data and annual figures may occur for EU and euro area aggregates due to exchange rates effects. Differences between annualised seasonally adjusted data and annual data occur for technical reasons. Differences between quarterly and annual GDP figures also occur, due to differences in data updates.

Differences between the change in total revenue and total expenditure and the change in surplus (+) / deficit (-) are due to rounding, as are differences between data in percentage of GDP and changes in data in percentage points of GDP.

Since the first quarter of 2020, Member States have implemented COVID-19 containment measures. In all quarters of 2022 and 2023, the impact of the measures to mitigate the economic and social impact of the COVID-19 pandemic had a significantly lower impact than in quarters of 2020 and 2021. However, in the first quarter of 2024, government revenue and expenditure continued to be impacted by the measures undertaken by most Member States to alleviate the impact of increasing energy prices, but to a lesser extent than for previous quarters. Country specific explanatory metadata are published.

A full harmonisation of recording practices for measures to alleviate the impact of increasing energy prices was not yet achieved. Revisions in the coming quarters are thus expected to be larger than usual.

Geographical information

Euro area (EA20): Belgium, Germany, Estonia, Ireland, Greece, Spain, France, Croatia, Italy, Cyprus, Latvia, Lithuania, Luxembourg, Malta, the Netherlands, Austria, Portugal, Slovenia, Slovakia and Finland.

European Union (EU27): Belgium, Bulgaria, Czechia, Denmark, Germany, Estonia, Ireland, Greece, Spain, France, Croatia, Italy, Cyprus, Latvia, Lithuania, Luxembourg, Hungary, Malta, the Netherlands, Austria, Poland, Portugal, Romania, Slovenia, Slovakia, Finland and Sweden.

For more information

  • “Statistics Explained” article on quarterly government finance statistics

  • Database section on quarterly non-financial accounts for general government

  • Further data are available in the “Presentation on integrated government finance statistics

  • ESA 2010: Regulation (EU) No 549/2013 on the European system of national and regional accounts in the European Union

  • Most recent government deficit and debt News Release

  • Euro indicators dashboard

  • Release calendar for Euro indicators

  • European Statistics Code of Practice

Get in touch

Media requests

Eurostat Media Support

Phone: (+352) 4301 33 408

E-mail: eurostat-mediasupport@ec.europa.eu

Further information on data

Kurt WASS

Laura WAHRIG

Phone: (+352) 4301 37 687

E-mail: estat-stpfs-data@ec.europa.eu

Mihail ANDREEV

Edoardo PIZZOLI

Floris JANSEN

Share component will be rendered here.

'; /** Retrieve the order from the tooltip option */ var sortOrder = option.tooltip.order; /** Sort the 'params' array based on the 'sortOrder' parameter. */ switch (sortOrder) { /** Sort by series name in ascending order. */ case 'seriesAsc': params = params.sort((a, b) => a.seriesName.localeCompare(b.seriesName)); break; /** Sort by series name in descending order. */ case 'seriesDesc': params = params.sort((a, b) => b.seriesName.localeCompare(a.seriesName)); break; /** Sort by numerical value in ascending order. */ case 'valueAsc': params = params.sort((a, b) => parseFloat(a.value) - parseFloat(b.value)); break; /** Sort by numerical value in descending order. */ case 'valueDesc': params = params.sort((a, b) => parseFloat(b.value) - parseFloat(a.value)); break; /** Reverse the current order. */ case 'reverse': params.reverse(); break; default: break; } /** Iterate over each series in the tooltip parameters */ for (var i = 0; i < params.length; i++) { /** Retrieve the name and value of the current series */ var seriesName = params[i].seriesName; var value = params[i].value; /** Replace every specific apostrphe by simple one. */ seriesName = seriesName.replaceAll("’", "'"); /** Convert the numeric value to its string representation. */ var strValue = String(value); /** Retrieve the axis used as value */ var axis = option.yAxis.type === 'value' ? option.yAxis : option.xAxis; /** Initialize the number of decimal places */ var decimals = option.tooltip.decimals; /** Check if decimals configuration is set to default and the value contains decimal places */ if (!decimals && strValue.indexOf('.') > -1) { /** Calculate the number of decimal places */ decimals = strValue.substring(strValue.indexOf('.'), strValue.length - 1).length; } else { /** If there are no decimal places, format the value with 1 decimal place */ decimals = decimals ? decimals : 1; /** Convert the value to a fixed-point notation string with a specified number of decimal places. */ value = Number(value).toFixed(decimals); } /** Convert -0 value to 0 with the specified or calculated number of decimal places.*/ if (Number(value) == -0) { value = (Number(value) + 0).toFixed(decimals); } /** Extract the unit from within the axis label */ var unit = axis.axisLabel.unit ? axis.axisLabel.unit : ''; /** Format the value using the appropriate number of decimal places */ value = isNaN(value) ? 'N/A' : Number(value).toLocaleString(option.lang ? option.lang : 'en', { minimumFractionDigits: decimals }) + unit; /** Retrieve the color of the current series */ const color = params[i].color; /** * Add the series name and value to the tooltip content * Use a circle icon with the series color */ tooltipContent += '

' + '' + '' + '' + seriesName + '' + '' + '' + value + '' + '

'; } /** Close the tooltip content container */ tooltipContent += '

'; /** Return the formatted tooltip content */ return tooltipContent; }}/* * This content is licensed according to the W3C Software License at * https://www.w3.org/Consortium/Legal/2015/copyright-software-and-document * * File: sortable-table.js * * Desc: Adds sorting to a HTML data table that implements ARIA Authoring Practices */'use strict';class SortableTable { constructor(tableNode) { this.tableNode = tableNode; this.columnHeaders = tableNode.querySelectorAll('thead th.sortable'); this.sortColumns = []; for (var i = 0; i < this.columnHeaders.length; i++) { var ch = this.columnHeaders[i]; var buttonNode = ch.querySelector('button'); if (buttonNode) { this.sortColumns.push(i); // buttonNode.setAttribute('data-column-index', i); // buttonNode.addEventListener('click', this.handleClick.bind(this)); ch.setAttribute('data-column-index', i); ch.addEventListener('click', this.handleClick.bind(this)); } } this.optionCheckbox = document.querySelector( 'input[type="checkbox"][value="show-unsorted-icon"]' ); if (this.optionCheckbox) { this.optionCheckbox.addEventListener( 'change', this.handleOptionChange.bind(this) ); if (this.optionCheckbox.checked) { this.tableNode.classList.add('show-unsorted-icon'); } } } setColumnHeaderSort(columnIndex) { if (typeof columnIndex === 'string') { columnIndex = parseInt(columnIndex); } for (var i = 0; i < this.columnHeaders.length; i++) { var ch = this.columnHeaders[i]; var buttonNode = ch.querySelector('button'); if (i === columnIndex) { var value = ch.getAttribute('aria-sort'); if (value === 'ascending') { ch.setAttribute('aria-sort', 'descending'); this.sortColumn( columnIndex, 'descending', ch.classList.contains('num')); } else if (value === 'descending') { ch.removeAttribute('aria-sort'); this.sortColumn( columnIndex, 'initial', true ); } else { ch.setAttribute('aria-sort', 'ascending'); this.sortColumn( columnIndex, 'ascending', ch.classList.contains('num') ); } } else { if (ch.hasAttribute('aria-sort') && buttonNode) { ch.removeAttribute('aria-sort'); } } } } sortColumn(columnIndex, sortValue, isNumber) { function compareValues(a, b) { if (a.value === b.value) return 0; if (sortValue === 'descending') { return isNumber ? b.value - a.value : (a.value > b.value ? -1 : 1); } else { return isNumber ? a.value - b.value : (a.value < b.value ? -1 : 1); } } if (typeof isNumber !== 'boolean') { isNumber = false; } var tbodyNode = this.tableNode.querySelector('tbody'); var rowNodes = []; var dataCells = []; var rowNode = tbodyNode.firstElementChild; var index = 0; while (rowNode) { rowNodes.push(rowNode); var rowCells = rowNode.querySelectorAll('th, td'); var dataCell = rowCells[columnIndex]; var data = {}; data.index = index; if (sortValue !== 'initial') { data.value = dataCell.textContent.toLowerCase().trim(); } else { data.value = rowNode.getAttribute('initial-position').toLowerCase().trim(); } if (isNumber) { data.value = parseFloat(data.value); } dataCells.push(data); rowNode = rowNode.nextElementSibling; index += 1; } dataCells.sort(compareValues); // remove rows while (tbodyNode.firstChild) { tbodyNode.removeChild(tbodyNode.lastChild); } // add sorted rows for (var i = 0; i < dataCells.length; i += 1) { let pos = [dataCells[i].index]; if (sortValue === "initial") { rowNodes[pos].classList.remove("sorted"); } else { rowNodes[pos].classList.add("sorted"); } tbodyNode.appendChild(rowNodes[pos]); } } /* EVENT HANDLERS */ handleClick(event) { var tgt = event.currentTarget; this.setColumnHeaderSort(tgt.getAttribute('data-column-index')); } handleOptionChange(event) { var tgt = event.currentTarget; if (tgt.checked) { this.tableNode.classList.add('show-unsorted-icon'); } else { this.tableNode.classList.remove('show-unsorted-icon'); } }}$(document).ready(function() { load(); });;}());

Subscribe to receive the latest Eurostat Euro indicators releases

Subscribe
Seasonally adjusted government deficit at 3.2% of GDP in the euro area and 3.0% in the EU (2024)

References

Top Articles
Latest Posts
Article information

Author: Roderick King

Last Updated:

Views: 6542

Rating: 4 / 5 (71 voted)

Reviews: 86% of readers found this page helpful

Author information

Name: Roderick King

Birthday: 1997-10-09

Address: 3782 Madge Knoll, East Dudley, MA 63913

Phone: +2521695290067

Job: Customer Sales Coordinator

Hobby: Gunsmithing, Embroidery, Parkour, Kitesurfing, Rock climbing, Sand art, Beekeeping

Introduction: My name is Roderick King, I am a cute, splendid, excited, perfect, gentle, funny, vivacious person who loves writing and wants to share my knowledge and understanding with you.