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

Calculating Percentage within a Row

Hi all,

 

I am working on a POP&L that displays a dollar value by customer (row) and account number (column) and I want to include a column that calculates percent of net revenue (dollar value/net revenue). The accounts are broken out by category, so a customer's net revenue represents the sum of values in that customer's revenue category. The net revenue measure needs to ignore the column it is in because it should always sum the revenue category, but it should take into account the row it is in (customer) and any explicit filters applied.

 

ALLSELECTED() retains only explicit filters and ALLEXCEPT() retains the row filter, but I am having trouble combining them. I tried using an inner join to combine the commands, but the result usually only applies one of the commands.

 

Net Revenue by Customer  = CALCULATE(SUM([Amount]), FILTER(NATURALINNERJOIN(ALLEXCEPT('GL Entries', 'GL Entries'[Customer]), ALLSELECTED('GL Entries'), 'GL Entries'[Account Category] = "Revenue"))

 

I am looking for a formula for Net Revenue by Customer, where [% Net] = DIVIDE([Amount], [Net Revenue by Customer]). One way to know if it is working correctly is if the percent of net revenue in the total of the revenue column is 100%.

 

Any ideas?

Thanks

 

GL Entries              
 CategoryRevenue     COGS     Total 
Account5100 - Sales 5200 - Returns Total 6100 - Purchases 6200 - Expenses Total   
CustomerAmount% NetAmount% NetAmount% NetAmount% NetAmount% NetAmount% NetAmount% Net
Cust 1$2000103%-$50-3%$1950100%-$1000-51%-$500-26%-$1500-77%$45023%
Cust 2$3000100%$00%$3000100%-$2000-67%-$500-17%-$2500-83%$50017%
Cust 3$1000111%-$100-11%$900100%-$400-44%-$550-61%-$950-106%-$50-6%
Cust 4$5000125%-$1000-25%$4000100%-$1000-25%-$2750-69%-$3750-94%$2506%
Cust 5$4000101%-$20-1%$3980100%-$1500-38%-$2000-50%-$3500-88%$48012%
Total$15000108%-$1170-8%$13830100%-$5900-43%-$6300-46%-$12200-88%$163012%

 

1 REPLY 1
Greg_Deckler
Super User
Super User

@ratgdillon Not really enough information to go on, please first check if your issue is a common issue listed here: https://community.powerbi.com/t5/Community-Blog/Before-You-Post-Read-This/ba-p/1116882

Also, please see this post regarding How to Get Your Question Answered Quickly: https://community.powerbi.com/t5/Community-Blog/How-to-Get-Your-Question-Answered-Quickly/ba-p/38490

The most important parts are:
1. Sample data as text, use the table tool in the editing bar
2. Expected output from sample data
3. Explanation in words of how to get from 1. to 2.


@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
Mastering Power BI 2nd Edition

DAX is easy, CALCULATE makes DAX hard...

Helpful resources

Announcements
Carousel_PBI_Wave1

2023 Release Wave 1 Plans

Power BI release plans for 2023 release wave 1 describes all new features releasing from April 2023 through September 2023.

Power BI Summit Carousel 2

Global Power BI Training

Make sure you register today for the Power BI Summit 2023. Don't miss all of the great sessions and speakers!

BizApps LATAM 2023

Business Application LATAM Summit 2023

Join the biggest FREE Business Applications Event in LATAM this February.

Power Platform Bootcamp

Global Power Platform Bootcamp

In this bootcamp we will deep-dive into Microsoft’s Power Platform stack with hands-on sessions and labs, delivered to you by experts and community leaders.

Top Solution Authors
Top Kudoed Authors