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

View all the Fabric Data Days sessions on demand. View schedule

Reply
5B
Regular Visitor

Assistance Needed with DAX Calculation

Hi all, 

I'm new to Power Bi and I'm having an issue with a calculation. I am trying to calculate the share of sales an item holds. This is done by dividing the number of items sold by the Total Sales of a selected period. Using the sample table below:

 

Total Sales = 14,700 (2500+9000+1500+1700)
Sales Share (Soft Drink) = Qty / Total Sales
                                       = 100 / 14700 = 0.006802721

DescriptionQtyTotal SalesSales Share
Soft Drink10025000.006802721
Pizza5790000.003877551
Burger2515000.00170068
Sandwich1717000.001156463

 

Best regards,
Stephanie.

1 ACCEPTED SOLUTION
tackytechtom
Super User
Super User

Hi @5B ,

 

How about this:

tackytechtom_0-1698173705234.png

 

 

Here the DAX code for the measure:

Measure = 
DIVIDE ( 
    SUM ( 'Table'[Qty] ), 
    CALCULATE ( 
        SUM ( 'Table'[Total Sales] ),
         ALL ( 'Table' )
    )
)

 

Let me know if this helps 🙂

 

/Tom
https://www.tackytech.blog/
https://www.instagram.com/tackytechtom/



Did I answer your question➡️ Please, mark my post as a solution ✔️

Also happily accepting Kudos 🙂

Feel free to connect with me on LinkedIn! linkedIn

#proudtobeasuperuser 

View solution in original post

3 REPLIES 3
chonchar
Helper V
Helper V

Hi, @5B 

 

I will try my best to help. Try this:

 

Total Shares Sales =
VAR _TotalSales =
CALCULATE(
    [Total],  
    ALL('TableName'[TotalSales])) // Your table name goes in 'TableName'
Return
DIVIDE(
    [Total Sales],
    _TotalDomains,0)
 
Best,
Cam

 

tackytechtom
Super User
Super User

Hi @5B ,

 

How about this:

tackytechtom_0-1698173705234.png

 

 

Here the DAX code for the measure:

Measure = 
DIVIDE ( 
    SUM ( 'Table'[Qty] ), 
    CALCULATE ( 
        SUM ( 'Table'[Total Sales] ),
         ALL ( 'Table' )
    )
)

 

Let me know if this helps 🙂

 

/Tom
https://www.tackytech.blog/
https://www.instagram.com/tackytechtom/



Did I answer your question➡️ Please, mark my post as a solution ✔️

Also happily accepting Kudos 🙂

Feel free to connect with me on LinkedIn! linkedIn

#proudtobeasuperuser 

Hey Tom,

It worked! Thank you.

I added in
FILTER(ALL('Table'), 'Table'[Date] IN VALUES('Table'[Date]))

Really appreciate it!

Helpful resources

Announcements
November Power BI Update Carousel

Power BI Monthly Update - November 2025

Check out the November 2025 Power BI update to learn about new features.

Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

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.

Top Solution Authors
Top Kudoed Authors