Join us at FabCon Atlanta from March 16 - 20, 2026, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.
Register now!The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more
Hi, I am new to Power BI and am trying to create a measure that calculates the percentage of sales that were done online, but each store provides their sales differently. Some stores provide in store and online sales by transaction while other stores only provide online total and combined total sales (see below for example)
| $ Sales | Channel | Store |
| 50 | In Store | A |
| 25 | Online | A |
| 70 | In Store | A |
| 15 | Online | B |
| 80 | Total | B |
How do I create a measure that sums up all online sales, then divides by total sales?
My trouble is calculating the total sales because I need the measure to combine all Store A sales, but only take Total from Store B and not add Online to Store B's total sales.
In this example, the measure would be:
Online / Total --> (25+15) / (50+25+70+80) = 40 / 225 = 17.8%
For context, there are a total of 16 stores, 7 of which provide online and total sales, while 9 stores provide In Store and Online Sales.
The farthest I've been able to get is this:
Solved! Go to Solution.
@RandomRaisin try these two measures, you can always divide these into seperate measures:
Sum Sales = SUM ( [$ Sales] )
Total Sales =
VAR __StoreWithTotalSales =
CALCULATETABLE (
VALUES ( 'Table'[Store] ),
'Table'[Channel] = "Total"
)
VAR __StoreThatHasOnlineSalesWithTotal =
CALCULATE (
[Sum Sales],
__StoreWithTotalSales,
'Table'[Channel] = "Online"
)
VAR __OnlineSales =
CALCULATE (
[Sum Sales],
'Table'[Channel] = "Online"
)
VAR __TotalSales = CALCULATE ( [Sum Sales], ALL ( 'Table' ) )
RETuRN DIVIDE ( __OnlineSales, __TotalSales - __StoreThatHasOnlineSalesWithTotal )
I would ❤ Kudos if my solution helped. 👉 If you can spend time posting the question, you can also make efforts to give Kudos to whoever helped to solve your problem. It is a token of appreciation!
Subscribe to the @PowerBIHowTo YT channel for an upcoming video on List and Record functions in Power Query!!
Learn Power BI and Fabric - subscribe to our YT channel - Click here: @PowerBIHowTo
If my solution proved useful, I'd be delighted to receive Kudos. When you put effort into asking a question, it's equally thoughtful to acknowledge and give Kudos to the individual who helped you solve the problem. It's a small gesture that shows appreciation and encouragement! ❤
Did I answer your question? Mark my post as a solution. Proud to be a Super User! Appreciate your Kudos 🙂
Feel free to email me with any of your BI needs.
@RandomRaisin try these two measures, you can always divide these into seperate measures:
Sum Sales = SUM ( [$ Sales] )
Total Sales =
VAR __StoreWithTotalSales =
CALCULATETABLE (
VALUES ( 'Table'[Store] ),
'Table'[Channel] = "Total"
)
VAR __StoreThatHasOnlineSalesWithTotal =
CALCULATE (
[Sum Sales],
__StoreWithTotalSales,
'Table'[Channel] = "Online"
)
VAR __OnlineSales =
CALCULATE (
[Sum Sales],
'Table'[Channel] = "Online"
)
VAR __TotalSales = CALCULATE ( [Sum Sales], ALL ( 'Table' ) )
RETuRN DIVIDE ( __OnlineSales, __TotalSales - __StoreThatHasOnlineSalesWithTotal )
I would ❤ Kudos if my solution helped. 👉 If you can spend time posting the question, you can also make efforts to give Kudos to whoever helped to solve your problem. It is a token of appreciation!
Subscribe to the @PowerBIHowTo YT channel for an upcoming video on List and Record functions in Power Query!!
Learn Power BI and Fabric - subscribe to our YT channel - Click here: @PowerBIHowTo
If my solution proved useful, I'd be delighted to receive Kudos. When you put effort into asking a question, it's equally thoughtful to acknowledge and give Kudos to the individual who helped you solve the problem. It's a small gesture that shows appreciation and encouragement! ❤
Did I answer your question? Mark my post as a solution. Proud to be a Super User! Appreciate your Kudos 🙂
Feel free to email me with any of your BI needs.
Thank you @parry2k! I changed the calculations a little bit, but using Variables with CALCULATETABLE worked perfectly for me! Thank you so much!
The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!
Check out the November 2025 Power BI update to learn about new features.
| User | Count |
|---|---|
| 59 | |
| 43 | |
| 42 | |
| 23 | |
| 17 |
| User | Count |
|---|---|
| 190 | |
| 122 | |
| 96 | |
| 66 | |
| 47 |