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

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

Reply
BullGangGeneral
Regular Visitor

calculate percentages

how would you do a measure base on this scenario?

 

I have sales in all 50 states of America, each state has multiple sales, I drag individual sales amount onto a table, as well as the states, now i want to be able to calculate the the percentage each sale is of the total of that state. so lets say new york state has 2 sales, 5 and 10 dollars, and new jersey has 3 sales, 2, 3, 5 dollars each. i want to be able to show the 5 dollar sale in ny is 33% of the total for new york which is 15, and i also want to be able to show the 2 dollar sale for new jersey as 20% for new jersey because new jersey has total 10 dollar in sales.

 

any help is appreciated.

4 REPLIES 4
Anonymous
Not applicable

Hi @BullGangGeneral,

Can you please share a pbix or some dummy data that keep raw data structure with expected results? It should help us clarify your scenario and test to coding formula.

How to Get Your Question Answered Quickly  

Regards,

Xiaoxin Sheng

amitchandak
Super User
Super User

@BullGangGeneral , Try a measure

 

Divide(sum(Table[Sale]), calculate(sum(Table[Sales]), allselected()))

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

meh didn't work for me. i also tried allexcept, it just return percentage of grand total instead of sub total.

Anonymous
Not applicable

Hi @BullGangGeneral,

Any update for these? The measure expressions calculation is based on current row content levels.
For this scenario, it means you need to cancel the fields aggregate or add unique fields to prevent the summary on the row level. Then the expression can be calculated on each row instead of showing one row with a summarized value and the result 1 on the total level.

formula =
DIVIDE (
    SUM ( Table[Sales] ),
    CALCULATE (
        SUM ( Table[Sales] ),
        ALLSELECTED ( Table ),
        VALUES ( Table[State] )
    )
)

Regards,
Xiaoxin Sheng

Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!

December 2025 Power BI Update Carousel

Power BI Monthly Update - December 2025

Check out the December 2025 Power BI Holiday Recap!

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.