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

The Power BI DataViz World Championships are on! With four chances to enter, you could win a spot in the LIVE Grand Finale in Las Vegas. Show off your skills.

Reply
gaccho_na
New Member

How to create composition ratio in powerBI

Hello,

 

I want to display output table B from data table A.

Too difficult for me.

Please Help me !

 

data table A

DateDIVvalue
2020/04Net Sales600,000
2020/04Cost of Sales300,000
2020/04Gross Profit300,000
2020/04SGA expenses120,000
2020/04Operating income180,000
2020/05Net Sales800,000
2020/05Cost of Sales390,000
2020/05Gross Profit410,000
2020/05SGA expenses125,000
2020/05Operating income285,000
2020/06Net Sales500,000
2020/06Cost of Sales260,000
2020/06Gross Profit240,000
2020/06SGA expenses120,000
2020/06Operating income120,000

 

output table B

 TTL Valuecomposition ratio 
Net Sales1,900,000100.0% 
Cost of Sales900,00047.4%Cost of Sales / Net Sales
Gross Profit1,000,00052.6%Gross Profit / Net Sales
SGA expenses400,00021.1%SGA expenses / Net Sales
Operating income600,00031.6%Operating income / Net Sales

 

1 ACCEPTED SOLUTION
daXtreme
Solution Sage
Solution Sage

// Base measure
[Total Value] = SUM( 'Table'[Value] )

[Composition Ratio] =
var NetSalesAmount = 
    CALCULATE(
        [Total Value],
        'Table'[DIV] = "Net Sales"
    )
var Result =
    DIVIDE(
        [Total Value],
        NetSalesAmount
    )
return
    Result

View solution in original post

2 REPLIES 2
daXtreme
Solution Sage
Solution Sage

// Base measure
[Total Value] = SUM( 'Table'[Value] )

[Composition Ratio] =
var NetSalesAmount = 
    CALCULATE(
        [Total Value],
        'Table'[DIV] = "Net Sales"
    )
var Result =
    DIVIDE(
        [Total Value],
        NetSalesAmount
    )
return
    Result
Smalfly
Responsive Resident
Responsive Resident

Hi @gaccho_na ,

 

please have a look at this expample file and let me know if this helps you to solve your issue.

Helpful resources

Announcements
Feb2025 Sticker Challenge

Join our Community Sticker Challenge 2025

If you love stickers, then you will definitely want to check out our Community Sticker Challenge!

Jan NL Carousel

Fabric Community Update - January 2025

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

Top Solution Authors