Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Earn the coveted Fabric Analytics Engineer certification. 100% off your exam for a limited time only!

Reply
jamuka
Advocate II
Advocate II

How to compare Row Total with column's Grand Total

Hello,

 

 

I'd like to calculate Total of Category1 / Total of Total (e.g 1.570.673/4.272.815).

I tried 

Distrubition = DIVIDE(Listing[Total];[Total(Stock_Amount)])

but it shows %100 for all rows. Also I tried to get percentage of each columns Total (e.g 16.500/4.272.815) but couldn't find the answer too.

 

kind regards

image.png

1 REPLY 1
Anonymous
Not applicable

-- First of all, [Total] must be the main measure.
-- Then, Distribution can be calculated as:

[Distribution] =
-- Category must be the one that you put
-- on the visual to break down calculations
-- by.
var __visibleCategories = ALLSELECTED( T[Category] )
var __totalAcrossVisibleCategories =
	CALCULATE(
		[Total],
		__visibleCategories
	)
var __totalForThisCategory = [Total]
var __distribution = 
	DIVIDE(
		__totalForThisCategory,
		__totalAcrossVisibleCategories
	)
return
	__distribution
	
-- WARNING:
-- Do not ever use this measure in model
-- measures that iterate over a table. If
-- you do, you'll be sorry rather sooner
-- than later. This measure is safe only
-- when used in visuals.

Best

Darek

Helpful resources

Announcements
April AMA free

Microsoft Fabric AMA Livestream

Join us Tuesday, April 09, 9:00 – 10:00 AM PST for a live, expert-led Q&A session on all things Microsoft Fabric!

March Fabric Community Update

Fabric Community Update - March 2024

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

Top Solution Authors