cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
jamuka Frequent Visitor
Frequent Visitor

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
Super User
Super User

Re: How to compare Row Total with column's Grand Total

-- 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
Community Highlights

Community Highlights

Find out what's new in the Power BI Community!

Summit North America

Power Platform Summit North America

Register by September 5 to save $200

Virtual Launch Event

Microsoft Business Applications Virtual Launch Event

Watch the event on demand for an in-depth look at the new innovations across Dynamics 365 and the Microsoft Power Platform.

MBAS Gallery

Watch Sessions On Demand!

Continue your learning in our online communities.

Top Kudoed Authors
Users Online
Currently online: 97 members 1,737 guests
Please welcome our newest community members: