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

Grow your Fabric skills and prepare for the DP-600 certification exam by completing the latest Microsoft Fabric challenge.

Reply
JonathanK1999
Frequent Visitor

Dividing all rows by a calculated value

I have created an income statement, and want to divide every single row by the total sales row in a table that looks something like this: 

 

CategorySum of TotalDESIRED ANSWER
Sales $1,000.00 
Food $240.0024%
Clothing $56.006%
Beverages $60.006%
Tickets $644.0064%
COGS $840.0084%
Food $90.009%
Beverages $10.001%
Paper $40.004%
Labor $100.0010%
Rent $600.0060%
Non operating expense $90.009%
Admin. $50.005%
Water $40.004%
Total $70.007%

 

However, each time I try to divide to get the desired answer, I only get the % of the sales components, not of all other rows. I know that for me to get the % for clothing for instance I have to do individual functions like:

 

% clothing of total sales = (DIVIDE((CALCULATE(SUM(ConsolidadoPG[Sum of Total]), ConsolidadoPG[Codigo Unico Linea PG]="Clothing")), CALCULATE(SUM(ConsolidadoPG[Sum of Total]), ConsolidadoPG[Categoria]="Sales")))

 

But how can I create a formula that drags to all rows, and does not filter. So that in a column in the table that would be a row called % of total sales.

2 REPLIES 2
amitchandak
Super User
Super User

@JonathanK1999 , try like

 

% total sales = DIVIDE(CALCULATE(SUM(ConsolidadoPG[Sum of Total])), CALCULATE(SUM(ConsolidadoPG[Sum of Total]), ConsolidadoPG[Categoria]="Sales"))

 

 

or

 

% total sales = DIVIDE(CALCULATE(SUM(ConsolidadoPG[Sum of Total])), CALCULATE(SUM(ConsolidadoPG[Sum of Total]), Filter( all(ConsolidadoPG) , ConsolidadoPG[Categoria]="Sales")) )

 

or

 

% total sales = DIVIDE(CALCULATE(SUM(ConsolidadoPG[Sum of Total])), CALCULATE(SUM(ConsolidadoPG[Sum of Total]), Filter( allselected(ConsolidadoPG) , ConsolidadoPG[Categoria]="Sales")) )

Did not work, I am not getting the desired answer, and its just filtering for the values that fall under the sales sub category, such as food, clothing, beverages and tickets in the example above.

Helpful resources

Announcements
RTI Forums Carousel3

New forum boards available in Real-Time Intelligence.

Ask questions in Eventhouse and KQL, Eventstream, and Reflex.

MayPowerBICarousel1

Power BI Monthly Update - May 2024

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

Top Kudoed Authors