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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

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
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

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

April Fabric Community Update

Fabric Community Update - April 2024

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

Top Solution Authors