feat: Inventory Dimension
diff --git a/erpnext/controllers/stock_controller.py b/erpnext/controllers/stock_controller.py
index e90a4f6..da7f5e2 100644
--- a/erpnext/controllers/stock_controller.py
+++ b/erpnext/controllers/stock_controller.py
@@ -18,6 +18,9 @@
 from erpnext.accounts.utils import get_fiscal_year
 from erpnext.controllers.accounts_controller import AccountsController
 from erpnext.stock import get_warehouse_account_map
+from erpnext.stock.doctype.inventory_dimension.inventory_dimension import (
+	get_evaluated_inventory_dimension,
+)
 from erpnext.stock.stock_ledger import get_items_to_be_repost
 
 
@@ -364,8 +367,16 @@
 		)
 
 		sl_dict.update(args)
+		if self.docstatus == 1:
+			self.update_inventory_dimensions(d, sl_dict)
+
 		return sl_dict
 
+	def update_inventory_dimensions(self, row, sl_dict) -> None:
+		dimension = get_evaluated_inventory_dimension(row, sl_dict, parent_doc=self)
+		if dimension:
+			sl_dict[dimension.target_fieldname] = row.get(dimension.source_fieldname)
+
 	def make_sl_entries(self, sl_entries, allow_negative_stock=False, via_landed_cost_voucher=False):
 		from erpnext.stock.stock_ledger import make_sl_entries
 
diff --git a/erpnext/public/js/utils.js b/erpnext/public/js/utils.js
index 62abb74..421a63a 100755
--- a/erpnext/public/js/utils.js
+++ b/erpnext/public/js/utils.js
@@ -224,6 +224,32 @@
 		});
 	},
 
+	add_inventory_dimensions: function(report_name, index) {
+		let filters = frappe.query_reports[report_name].filters;
+
+		frappe.call({
+			method: "erpnext.stock.doctype.inventory_dimension.inventory_dimension.get_inventory_dimensions",
+			callback: function(r) {
+				if (r.message && r.message.length) {
+					r.message.forEach((dimension) => {
+						let found = filters.some(el => el.fieldname === dimension['fieldname']);
+
+						if (!found) {
+							filters.splice(index, 0, {
+								"fieldname": dimension["fieldname"],
+								"label": __(dimension["label"]),
+								"fieldtype": "MultiSelectList",
+								get_data: function(txt) {
+									return frappe.db.get_link_options(dimension["doctype"], txt);
+								},
+							});
+						}
+					});
+				}
+			}
+		});
+	},
+
 	make_subscription: function(doctype, docname) {
 		frappe.call({
 			method: "frappe.automation.doctype.auto_repeat.auto_repeat.make_auto_repeat",
diff --git a/erpnext/stock/doctype/inventory_dimension/__init__.py b/erpnext/stock/doctype/inventory_dimension/__init__.py
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/erpnext/stock/doctype/inventory_dimension/__init__.py
diff --git a/erpnext/stock/doctype/inventory_dimension/inventory_dimension.js b/erpnext/stock/doctype/inventory_dimension/inventory_dimension.js
new file mode 100644
index 0000000..1256659
--- /dev/null
+++ b/erpnext/stock/doctype/inventory_dimension/inventory_dimension.js
@@ -0,0 +1,58 @@
+// Copyright (c) 2022, Frappe Technologies Pvt. Ltd. and contributors
+// For license information, please see license.txt
+
+frappe.ui.form.on('Inventory Dimension', {
+	setup(frm) {
+		frm.trigger('set_query_on_fields');
+	},
+
+	set_query_on_fields(frm) {
+		frm.set_query('reference_document', () => {
+			let invalid_doctypes = frappe.model.core_doctypes_list;
+			invalid_doctypes.push('Batch', 'Serial No', 'Warehouse', 'Item', 'Inventory Dimension',
+				'Accounting Dimension', 'Accounting Dimension Filter');
+
+			return {
+				filters: {
+					'istable': 0,
+					'issingle': 0,
+					'name': ['not in', invalid_doctypes]
+				}
+			};
+		});
+
+		frm.set_query('document_type', () => {
+			return {
+				query: 'erpnext.stock.doctype.inventory_dimension.inventory_dimension.get_inventory_documents',
+			};
+		});
+	},
+
+	onload(frm) {
+		frm.trigger('render_traget_field');
+	},
+
+	map_with_existing_field(frm) {
+		frm.trigger('render_traget_field');
+	},
+
+	render_traget_field(frm) {
+		if (frm.doc.map_with_existing_field && !frm.doc.disabled) {
+			frappe.call({
+				method: 'erpnext.stock.doctype.inventory_dimension.inventory_dimension.get_source_fieldnames',
+				args: {
+					reference_document: frm.doc.reference_document,
+					ignore_document: frm.doc.name
+				},
+				callback: function(r) {
+					if (r.message && r.message.length) {
+						frm.set_df_property('stock_ledger_dimension', 'options', r.message);
+					} else {
+						frm.set_value("map_with_existing_field", 0);
+						frappe.msgprint(__('Inventory Dimensions not found'));
+					}
+				}
+			});
+		}
+	}
+});
diff --git a/erpnext/stock/doctype/inventory_dimension/inventory_dimension.json b/erpnext/stock/doctype/inventory_dimension/inventory_dimension.json
new file mode 100644
index 0000000..7e5df42
--- /dev/null
+++ b/erpnext/stock/doctype/inventory_dimension/inventory_dimension.json
@@ -0,0 +1,189 @@
+{
+ "actions": [],
+ "allow_rename": 1,
+ "autoname": "field:dimension_name",
+ "creation": "2022-06-17 13:04:16.554051",
+ "doctype": "DocType",
+ "editable_grid": 1,
+ "engine": "InnoDB",
+ "field_order": [
+  "dimension_details_tab",
+  "dimension_name",
+  "reference_document",
+  "disabled",
+  "section_break_7",
+  "field_mapping_section",
+  "source_fieldname",
+  "target_fieldname",
+  "column_break_9",
+  "map_with_existing_field",
+  "stock_ledger_dimension",
+  "applicable_for_documents_tab",
+  "apply_to_all_doctypes",
+  "document_type",
+  "istable",
+  "type_of_transaction",
+  "column_break_16",
+  "condition"
+ ],
+ "fields": [
+  {
+   "fieldname": "dimension_details_tab",
+   "fieldtype": "Tab Break",
+   "label": "Dimension Details"
+  },
+  {
+   "fieldname": "reference_document",
+   "fieldtype": "Link",
+   "in_list_view": 1,
+   "label": "Reference Document",
+   "options": "DocType",
+   "reqd": 1
+  },
+  {
+   "fieldname": "dimension_name",
+   "fieldtype": "Data",
+   "in_list_view": 1,
+   "label": "Dimension Name",
+   "reqd": 1,
+   "unique": 1
+  },
+  {
+   "fieldname": "applicable_for_documents_tab",
+   "fieldtype": "Tab Break",
+   "label": "Applicable For Documents"
+  },
+  {
+   "depends_on": "eval:!doc.apply_to_all_doctypes",
+   "fieldname": "document_type",
+   "fieldtype": "Link",
+   "label": "Applicable to Document",
+   "mandatory_depends_on": "eval:!doc.apply_to_all_doctypes",
+   "options": "DocType"
+  },
+  {
+   "fieldname": "column_break_9",
+   "fieldtype": "Column Break"
+  },
+  {
+   "default": "0",
+   "depends_on": "eval:!doc.apply_to_all_doctypes && doc.document_type",
+   "fetch_from": "document_type.istable",
+   "fieldname": "istable",
+   "fieldtype": "Check",
+   "label": " Is Child Table",
+   "read_only": 1
+  },
+  {
+   "depends_on": "eval:!doc.apply_to_all_doctypes",
+   "fieldname": "condition",
+   "fieldtype": "Code",
+   "label": "Applicable Condition"
+  },
+  {
+   "default": "1",
+   "fieldname": "apply_to_all_doctypes",
+   "fieldtype": "Check",
+   "label": "Apply to All Document Types"
+  },
+  {
+   "default": "0",
+   "fieldname": "disabled",
+   "fieldtype": "Check",
+   "label": "Disabled"
+  },
+  {
+   "fieldname": "section_break_7",
+   "fieldtype": "Section Break"
+  },
+  {
+   "fieldname": "target_fieldname",
+   "fieldtype": "Data",
+   "label": "Target Fieldname (Stock Ledger Entry)",
+   "read_only": 1
+  },
+  {
+   "fieldname": "source_fieldname",
+   "fieldtype": "Data",
+   "label": "Source Fieldname",
+   "read_only": 1
+  },
+  {
+   "collapsible": 1,
+   "fieldname": "field_mapping_section",
+   "fieldtype": "Section Break",
+   "label": "Field Mapping"
+  },
+  {
+   "default": "0",
+   "fieldname": "map_with_existing_field",
+   "fieldtype": "Check",
+   "label": "Map with existing field"
+  },
+  {
+   "fieldname": "column_break_16",
+   "fieldtype": "Column Break"
+  },
+  {
+   "depends_on": "map_with_existing_field",
+   "fieldname": "stock_ledger_dimension",
+   "fieldtype": "Select",
+   "label": "Stock Ledger Dimension"
+  },
+  {
+   "fieldname": "type_of_transaction",
+   "fieldtype": "Select",
+   "label": "Type of Transaction",
+   "options": "\nInward\nOutward"
+  }
+ ],
+ "index_web_pages_for_search": 1,
+ "links": [],
+ "modified": "2022-06-22 10:56:43.753713",
+ "modified_by": "Administrator",
+ "module": "Stock",
+ "name": "Inventory Dimension",
+ "naming_rule": "By fieldname",
+ "owner": "Administrator",
+ "permissions": [
+  {
+   "create": 1,
+   "delete": 1,
+   "email": 1,
+   "export": 1,
+   "print": 1,
+   "read": 1,
+   "report": 1,
+   "role": "System Manager",
+   "share": 1,
+   "write": 1
+  },
+  {
+   "create": 1,
+   "delete": 1,
+   "email": 1,
+   "export": 1,
+   "print": 1,
+   "read": 1,
+   "report": 1,
+   "role": "Stock Manager",
+   "share": 1,
+   "write": 1
+  },
+  {
+   "create": 1,
+   "delete": 1,
+   "email": 1,
+   "export": 1,
+   "print": 1,
+   "read": 1,
+   "report": 1,
+   "role": "Stock User",
+   "share": 1,
+   "write": 1
+  }
+ ],
+ "sort_field": "modified",
+ "sort_order": "DESC",
+ "states": []
+}
\ No newline at end of file
diff --git a/erpnext/stock/doctype/inventory_dimension/inventory_dimension.py b/erpnext/stock/doctype/inventory_dimension/inventory_dimension.py
new file mode 100644
index 0000000..fd143da
--- /dev/null
+++ b/erpnext/stock/doctype/inventory_dimension/inventory_dimension.py
@@ -0,0 +1,163 @@
+# Copyright (c) 2022, Frappe Technologies Pvt. Ltd. and contributors
+# For license information, please see license.txt
+
+import frappe
+from frappe import _, scrub
+from frappe.custom.doctype.custom_field.custom_field import create_custom_fields
+from frappe.model.document import Document
+
+
+class InventoryDimension(Document):
+	def validate(self):
+		self.reset_value()
+		self.validate_reference_document()
+		self.set_source_and_target_fieldname()
+
+	def reset_value(self):
+		if self.apply_to_all_doctypes:
+			self.istable = 0
+			for field in ["document_type", "parent_field", "condition", "type_of_transaction"]:
+				self.set(field, None)
+
+	def validate_reference_document(self):
+		if frappe.get_cached_value("DocType", self.reference_document, "istable") == 1:
+			frappe.throw(_(f"The reference document {self.reference_document} can not be child table."))
+
+		if self.reference_document in ["Batch", "Serial No", "Warehouse", "Item"]:
+			frappe.throw(
+				_(f"The reference document {self.reference_document} can not be an Inventory Dimension.")
+			)
+
+	def set_source_and_target_fieldname(self):
+		self.source_fieldname = scrub(self.dimension_name)
+		if not self.map_with_existing_field:
+			self.target_fieldname = self.source_fieldname
+
+	def on_update(self):
+		self.add_custom_fields()
+
+	def add_custom_fields(self):
+		dimension_field = dict(
+			fieldname=self.source_fieldname,
+			fieldtype="Link",
+			insert_after="warehouse",
+			options=self.reference_document,
+			label=self.dimension_name,
+		)
+
+		custom_fields = {}
+
+		if self.apply_to_all_doctypes:
+			for doctype in get_inventory_documents():
+				if not frappe.db.get_value(
+					"Custom Field", {"dt": doctype[0], "fieldname": self.source_fieldname}
+				):
+					custom_fields.setdefault(doctype[0], dimension_field)
+		elif not frappe.db.get_value(
+			"Custom Field", {"dt": self.document_type, "fieldname": self.source_fieldname}
+		):
+			custom_fields.setdefault(self.document_type, dimension_field)
+
+		if not frappe.db.get_value(
+			"Custom Field", {"dt": "Stock Ledger Entry", "fieldname": self.target_fieldname}
+		):
+			dimension_field["fieldname"] = self.target_fieldname
+			custom_fields["Stock Ledger Entry"] = dimension_field
+
+		create_custom_fields(custom_fields)
+
+
+@frappe.whitelist()
+def get_inventory_documents(
+	doctype=None, txt=None, searchfield=None, start=None, page_len=None, filters=None
+):
+	and_filters = [["DocField", "parent", "not in", ["Batch", "Serial No"]]]
+	or_filters = [
+		["DocField", "options", "in", ["Batch", "Serial No"]],
+		["DocField", "parent", "in", ["Putaway Rule"]],
+	]
+
+	if txt:
+		and_filters.append(["DocField", "parent", "like", f"%{txt}%"])
+
+	return frappe.get_all(
+		"DocField",
+		fields=["distinct parent"],
+		filters=and_filters,
+		or_filters=or_filters,
+		start=start,
+		page_length=page_len,
+		as_list=1,
+	)
+
+
+def get_evaluated_inventory_dimension(doc, sl_dict, parent_doc=None) -> dict:
+	dimensions = get_document_wise_inventory_dimensions(doc.doctype)
+	for row in dimensions:
+		if (
+			row.type_of_transaction == "Inward"
+			if doc.docstatus == 1
+			else row.type_of_transaction != "Inward"
+		) and sl_dict.actual_qty < 0:
+			continue
+		elif (
+			row.type_of_transaction == "Outward"
+			if doc.docstatus == 1
+			else row.type_of_transaction != "Inward"
+		) and sl_dict.actual_qty > 0:
+			continue
+
+		if frappe.safe_eval(row.condition, {"doc": doc, "parent_doc": parent_doc}):
+			return row
+
+
+def get_document_wise_inventory_dimensions(doctype) -> dict:
+	if not hasattr(frappe.local, "document_wise_inventory_dimensions"):
+		frappe.local.document_wise_inventory_dimensions = {}
+
+	if doctype not in frappe.local.document_wise_inventory_dimensions:
+		dimensions = frappe.get_all(
+			"Inventory Dimension",
+			fields=["name", "source_fieldname", "condition", "target_fieldname", "type_of_transaction"],
+			filters={"disabled": 0},
+			or_filters={"document_type": doctype, "apply_to_all_doctypes": 1},
+		)
+
+		frappe.local.document_wise_inventory_dimensions[doctype] = dimensions
+
+	return frappe.local.document_wise_inventory_dimensions[doctype]
+
+
+@frappe.whitelist()
+def get_source_fieldnames(reference_document, ignore_document):
+	return frappe.get_all(
+		"Inventory Dimension",
+		fields=["source_fieldname as value", "dimension_name as label"],
+		filters={
+			"disabled": 0,
+			"map_with_existing_field": 0,
+			"name": ("!=", ignore_document),
+			"reference_document": reference_document,
+		},
+	)
+
+
+@frappe.whitelist()
+def get_inventory_dimensions():
+	if not hasattr(frappe.local, "inventory_dimensions"):
+		frappe.local.inventory_dimensions = {}
+
+	if not frappe.local.inventory_dimensions:
+		dimensions = frappe.get_all(
+			"Inventory Dimension",
+			fields=[
+				"distinct target_fieldname as fieldname",
+				"dimension_name as label",
+				"reference_document as doctype",
+			],
+			filters={"disabled": 0, "map_with_existing_field": 0},
+		)
+
+		frappe.local.inventory_dimensions = dimensions
+
+	return frappe.local.inventory_dimensions
diff --git a/erpnext/stock/doctype/inventory_dimension/test_inventory_dimension.py b/erpnext/stock/doctype/inventory_dimension/test_inventory_dimension.py
new file mode 100644
index 0000000..8d727b2
--- /dev/null
+++ b/erpnext/stock/doctype/inventory_dimension/test_inventory_dimension.py
@@ -0,0 +1,9 @@
+# Copyright (c) 2022, Frappe Technologies Pvt. Ltd. and Contributors
+# See license.txt
+
+# import frappe
+from frappe.tests.utils import FrappeTestCase
+
+
+class TestInventoryDimension(FrappeTestCase):
+	pass
diff --git a/erpnext/stock/report/stock_balance/stock_balance.js b/erpnext/stock/report/stock_balance/stock_balance.js
index ce6ffa0..9b3965d 100644
--- a/erpnext/stock/report/stock_balance/stock_balance.js
+++ b/erpnext/stock/report/stock_balance/stock_balance.js
@@ -102,3 +102,5 @@
 		return value;
 	}
 };
+
+erpnext.utils.add_inventory_dimensions('Stock Balance', 8);
\ No newline at end of file
diff --git a/erpnext/stock/report/stock_balance/stock_balance.py b/erpnext/stock/report/stock_balance/stock_balance.py
index 6369f91..3492b05 100644
--- a/erpnext/stock/report/stock_balance/stock_balance.py
+++ b/erpnext/stock/report/stock_balance/stock_balance.py
@@ -13,6 +13,7 @@
 from pypika.terms import ExistsCriterion
 
 import erpnext
+from erpnext.stock.doctype.inventory_dimension.inventory_dimension import get_inventory_dimensions
 from erpnext.stock.report.stock_ageing.stock_ageing import FIFOSlots, get_average_age
 from erpnext.stock.utils import add_additional_uom_columns, is_reposting_item_valuation_in_progress
 
@@ -66,9 +67,14 @@
 	_func = itemgetter(1)
 
 	to_date = filters.get("to_date")
-	for (company, item, warehouse) in sorted(iwb_map):
+
+	for group_by_key in iwb_map:
+		item = group_by_key[1]
+		warehouse = group_by_key[2]
+		company = group_by_key[0]
+
 		if item_map.get(item):
-			qty_dict = iwb_map[(company, item, warehouse)]
+			qty_dict = iwb_map[group_by_key]
 			item_reorder_level = 0
 			item_reorder_qty = 0
 			if item + warehouse in item_reorder_detail_map:
@@ -135,88 +141,104 @@
 			"options": "Warehouse",
 			"width": 100,
 		},
-		{
-			"label": _("Stock UOM"),
-			"fieldname": "stock_uom",
-			"fieldtype": "Link",
-			"options": "UOM",
-			"width": 90,
-		},
-		{
-			"label": _("Balance Qty"),
-			"fieldname": "bal_qty",
-			"fieldtype": "Float",
-			"width": 100,
-			"convertible": "qty",
-		},
-		{
-			"label": _("Balance Value"),
-			"fieldname": "bal_val",
-			"fieldtype": "Currency",
-			"width": 100,
-			"options": "currency",
-		},
-		{
-			"label": _("Opening Qty"),
-			"fieldname": "opening_qty",
-			"fieldtype": "Float",
-			"width": 100,
-			"convertible": "qty",
-		},
-		{
-			"label": _("Opening Value"),
-			"fieldname": "opening_val",
-			"fieldtype": "Currency",
-			"width": 110,
-			"options": "currency",
-		},
-		{
-			"label": _("In Qty"),
-			"fieldname": "in_qty",
-			"fieldtype": "Float",
-			"width": 80,
-			"convertible": "qty",
-		},
-		{"label": _("In Value"), "fieldname": "in_val", "fieldtype": "Float", "width": 80},
-		{
-			"label": _("Out Qty"),
-			"fieldname": "out_qty",
-			"fieldtype": "Float",
-			"width": 80,
-			"convertible": "qty",
-		},
-		{"label": _("Out Value"), "fieldname": "out_val", "fieldtype": "Float", "width": 80},
-		{
-			"label": _("Valuation Rate"),
-			"fieldname": "val_rate",
-			"fieldtype": "Currency",
-			"width": 90,
-			"convertible": "rate",
-			"options": "currency",
-		},
-		{
-			"label": _("Reorder Level"),
-			"fieldname": "reorder_level",
-			"fieldtype": "Float",
-			"width": 80,
-			"convertible": "qty",
-		},
-		{
-			"label": _("Reorder Qty"),
-			"fieldname": "reorder_qty",
-			"fieldtype": "Float",
-			"width": 80,
-			"convertible": "qty",
-		},
-		{
-			"label": _("Company"),
-			"fieldname": "company",
-			"fieldtype": "Link",
-			"options": "Company",
-			"width": 100,
-		},
 	]
 
+	for dimension in get_inventory_dimensions():
+		columns.append(
+			{
+				"label": _(dimension.label),
+				"fieldname": dimension.fieldname,
+				"fieldtype": "Link",
+				"options": dimension.doctype,
+				"width": 110,
+			}
+		)
+
+	columns.extend(
+		[
+			{
+				"label": _("Stock UOM"),
+				"fieldname": "stock_uom",
+				"fieldtype": "Link",
+				"options": "UOM",
+				"width": 90,
+			},
+			{
+				"label": _("Balance Qty"),
+				"fieldname": "bal_qty",
+				"fieldtype": "Float",
+				"width": 100,
+				"convertible": "qty",
+			},
+			{
+				"label": _("Balance Value"),
+				"fieldname": "bal_val",
+				"fieldtype": "Currency",
+				"width": 100,
+				"options": "currency",
+			},
+			{
+				"label": _("Opening Qty"),
+				"fieldname": "opening_qty",
+				"fieldtype": "Float",
+				"width": 100,
+				"convertible": "qty",
+			},
+			{
+				"label": _("Opening Value"),
+				"fieldname": "opening_val",
+				"fieldtype": "Currency",
+				"width": 110,
+				"options": "currency",
+			},
+			{
+				"label": _("In Qty"),
+				"fieldname": "in_qty",
+				"fieldtype": "Float",
+				"width": 80,
+				"convertible": "qty",
+			},
+			{"label": _("In Value"), "fieldname": "in_val", "fieldtype": "Float", "width": 80},
+			{
+				"label": _("Out Qty"),
+				"fieldname": "out_qty",
+				"fieldtype": "Float",
+				"width": 80,
+				"convertible": "qty",
+			},
+			{"label": _("Out Value"), "fieldname": "out_val", "fieldtype": "Float", "width": 80},
+			{
+				"label": _("Valuation Rate"),
+				"fieldname": "val_rate",
+				"fieldtype": "Currency",
+				"width": 90,
+				"convertible": "rate",
+				"options": "currency",
+			},
+			{
+				"label": _("Reorder Level"),
+				"fieldname": "reorder_level",
+				"fieldtype": "Float",
+				"width": 80,
+				"convertible": "qty",
+			},
+			{
+				"label": _("Reorder Qty"),
+				"fieldname": "reorder_qty",
+				"fieldtype": "Float",
+				"width": 80,
+				"convertible": "qty",
+			},
+			{
+				"label": _("Company"),
+				"fieldname": "company",
+				"fieldtype": "Link",
+				"options": "Company",
+				"width": 100,
+			},
+		]
+	)
+
 	if filters.get("show_stock_ageing_data"):
 		columns += [
 			{"label": _("Average Age"), "fieldname": "average_age", "width": 100},
@@ -296,11 +318,23 @@
 		.orderby(sle.actual_qty)
 	)
 
+	inventory_dimension_fields = get_inventory_dimension_fields()
+	if inventory_dimension_fields:
+		query = query.select(", ".join(inventory_dimension_fields))
+
+		for fieldname in inventory_dimension_fields:
+			if fieldname in filters and filters.get(fieldname):
+				query = query.where(sle[fieldname].isin(filters.get(fieldname)))
+
 	if items:
 		query = query.where(sle.item_code.isin(items))
 
 	query = apply_conditions(query, filters)
-	return query.run(as_dict=True)
+	return query.run(as_dict=True, debug=1)
+
+
+def get_inventory_dimension_fields():
+	return [dimension.fieldname for dimension in get_inventory_dimensions()]
 
 
 def get_item_warehouse_map(filters: StockBalanceFilter, sle: List[SLEntry]):
@@ -310,10 +344,12 @@
 
 	float_precision = cint(frappe.db.get_default("float_precision")) or 3
 
+	inventory_dimensions = get_inventory_dimension_fields()
+
 	for d in sle:
-		key = (d.company, d.item_code, d.warehouse)
-		if key not in iwb_map:
-			iwb_map[key] = frappe._dict(
+		group_by_key = get_group_by_key(d, inventory_dimensions)
+		if group_by_key not in iwb_map:
+			iwb_map[group_by_key] = frappe._dict(
 				{
 					"opening_qty": 0.0,
 					"opening_val": 0.0,
@@ -327,7 +363,9 @@
 				}
 			)
 
-		qty_dict = iwb_map[(d.company, d.item_code, d.warehouse)]
+		qty_dict = iwb_map[group_by_key]
+		for field in inventory_dimensions:
+			qty_dict[field] = d.get(field)
 
 		if d.voucher_type == "Stock Reconciliation" and not d.batch_no:
 			qty_diff = flt(d.qty_after_transaction) - flt(qty_dict.bal_qty)
@@ -356,24 +394,36 @@
 		qty_dict.bal_qty += qty_diff
 		qty_dict.bal_val += value_diff
 
-	iwb_map = filter_items_with_no_transactions(iwb_map, float_precision)
+	iwb_map = filter_items_with_no_transactions(iwb_map, float_precision, inventory_dimensions)
 
 	return iwb_map
 
 
-def filter_items_with_no_transactions(iwb_map, float_precision: float):
-	for (company, item, warehouse) in sorted(iwb_map):
-		qty_dict = iwb_map[(company, item, warehouse)]
+def get_group_by_key(row, inventory_dimension_fields) -> tuple:
+	group_by_key = [row.company, row.item_code, row.warehouse]
+
+	for fieldname in inventory_dimension_fields:
+		group_by_key.append(row.get(fieldname))
+
+	return tuple(group_by_key)
+
+
+def filter_items_with_no_transactions(iwb_map, float_precision: float, inventory_dimensions: list):
+	for group_by_key in iwb_map:
+		qty_dict = iwb_map[group_by_key]
 
 		no_transactions = True
 		for key, val in qty_dict.items():
+			if key in inventory_dimensions:
+				continue
+
 			val = flt(val, float_precision)
 			qty_dict[key] = val
 			if key != "val_rate" and val:
 				no_transactions = False
 
 		if no_transactions:
-			iwb_map.pop((company, item, warehouse))
+			iwb_map.pop(group_by_key)
 
 	return iwb_map
 
diff --git a/erpnext/stock/report/stock_ledger/stock_ledger.js b/erpnext/stock/report/stock_ledger/stock_ledger.js
index ef7c2cc..0def161 100644
--- a/erpnext/stock/report/stock_ledger/stock_ledger.js
+++ b/erpnext/stock/report/stock_ledger/stock_ledger.js
@@ -95,4 +95,6 @@
 
 		return value;
 	},
-}
+};
+
+erpnext.utils.add_inventory_dimensions('Stock Ledger', 10);
\ No newline at end of file
diff --git a/erpnext/stock/report/stock_ledger/stock_ledger.py b/erpnext/stock/report/stock_ledger/stock_ledger.py
index ef1642e..1104983 100644
--- a/erpnext/stock/report/stock_ledger/stock_ledger.py
+++ b/erpnext/stock/report/stock_ledger/stock_ledger.py
@@ -6,6 +6,7 @@
 from frappe import _
 from frappe.utils import cint, flt
 
+from erpnext.stock.doctype.inventory_dimension.inventory_dimension import get_inventory_dimensions
 from erpnext.stock.doctype.serial_no.serial_no import get_serial_nos
 from erpnext.stock.doctype.stock_reconciliation.stock_reconciliation import get_stock_balance_for
 from erpnext.stock.utils import (
@@ -17,7 +18,7 @@
 def execute(filters=None):
 	is_reposting_item_valuation_in_progress()
 	include_uom = filters.get("include_uom")
-	columns = get_columns()
+	columns = get_columns(filters)
 	items = get_items(filters)
 	sl_entries = get_stock_ledger_entries(filters, items)
 	item_details = get_item_details(items, sl_entries, include_uom)
@@ -33,12 +34,14 @@
 	actual_qty = stock_value = 0
 
 	available_serial_nos = {}
+	inventory_dimension_filters_applied = check_inventory_dimension_filters_applied(filters)
+
 	for sle in sl_entries:
 		item_detail = item_details[sle.item_code]
 
 		sle.update(item_detail)
 
-		if filters.get("batch_no"):
+		if filters.get("batch_no") or inventory_dimension_filters_applied:
 			actual_qty += flt(sle.actual_qty, precision)
 			stock_value += sle.stock_value_difference
 
@@ -88,7 +91,7 @@
 	sle.balance_serial_no = "\n".join(existing_serial_no)
 
 
-def get_columns():
+def get_columns(filters):
 	columns = [
 		{"label": _("Date"), "fieldname": "date", "fieldtype": "Datetime", "width": 150},
 		{
@@ -216,14 +219,28 @@
 			"options": "Project",
 			"width": 100,
 		},
+	]
+
+	for dimension in get_inventory_dimensions():
+		columns.append(
+			{
+				"label": _(dimension.label),
+				"fieldname": dimension.fieldname,
+				"fieldtype": "Link",
+				"options": dimension.doctype,
+				"width": 110,
+			}
+		)
+
+	columns.append(
 		{
 			"label": _("Company"),
 			"fieldname": "company",
 			"fieldtype": "Link",
 			"options": "Company",
 			"width": 110,
-		},
-	]
+		}
+	)
 
 	return columns
 
@@ -252,7 +269,7 @@
 			serial_no,
 			company,
 			project,
-			stock_value_difference
+			stock_value_difference {get_dimension_fields}
 		FROM
 			`tabStock Ledger Entry` sle
 		WHERE
@@ -263,7 +280,9 @@
 		ORDER BY
 			posting_date asc, posting_time asc, creation asc
 		""".format(
-			sle_conditions=get_sle_conditions(filters), item_conditions_sql=item_conditions_sql
+			sle_conditions=get_sle_conditions(filters),
+			item_conditions_sql=item_conditions_sql,
+			get_dimension_fields=get_dimension_fields(),
 		),
 		filters,
 		as_dict=1,
@@ -272,6 +291,15 @@
 	return sl_entries
 
 
+def get_dimension_fields() -> str:
+	fields = ""
+
+	for dimension in get_inventory_dimensions():
+		fields += f", {dimension.fieldname}"
+
+	return fields
+
+
 def get_items(filters):
 	conditions = []
 	if filters.get("item_code"):
@@ -341,6 +369,10 @@
 	if filters.get("project"):
 		conditions.append("project=%(project)s")
 
+	for dimension in get_inventory_dimensions():
+		if filters.get(dimension.fieldname):
+			conditions.append(f"{dimension.fieldname} in %({dimension.fieldname})s")
+
 	return "and {}".format(" and ".join(conditions)) if conditions else ""
 
 
@@ -401,3 +433,11 @@
 		)
 
 	return ""
+
+
+def check_inventory_dimension_filters_applied(filters) -> bool:
+	for dimension in get_inventory_dimensions():
+		if dimension.fieldname in filters and filters.get(dimension.fieldname):
+			return True
+
+	return False