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

Calling all Data Engineers! Fabric Data Engineer (Exam DP-700) live sessions are back! Starting October 16th. Sign up.

Reply
F003Yum
Regular Visitor

Grand Total measure in row of table/matrix, with filtering

I'm trying to create a table or matrix visual that looks something like this: 

Country    
StoreDateSalesTotal SalesShare of Sales
Nr12025-01-0110050020%
Nr22025-01-015050010%
Nr32025-01-0135050070%
Nr12025-02-0120080025%
Nr22025-02-0120080025%
Nr32025-02-0140080050%

 

So for each day, I want the grand total of Sales, per Country to be in the "Total Sales" column, and then I just divide the sales with the "total sales" column to get my share of sales.

But I'm having an issue with the Total Sales measure.

Because I also want to be able to filter on either Store Name, or Store Owner, and an owner can have multiple stores. And so If we use the example table above, and say that Bob owns store 2 & 3, then the Total Sales for 2025-01-01 would be 50-350 = 400, and the Shares of Sales would instead be 12,5% and 87,5%

 

I have a DateTable with Date Column, which I use in the table above

Sales come from SalesTable

Country and Store come from StoreTable

 

relations look like this:

F003Yum_0-1751534607142.png

 

 

The best result I've managed to get is a total that gives a total of the whole country, but it doesn't get affected by store or store owner slicers... 

 

Any suggestions? Thanks!

 

I need the compdate table for other pages/calcualtions. 

1 ACCEPTED SOLUTION

@v-kpoloju-msft 

Thanks again!

That looks good, the thing is I need the measure for another calculation, I then need to multiply it with another related value to get a weighted value. 

So ValueX times Share of Sales = Weighted Value. 

 

I might be wrong but I don't think that'll work when I do the Show Value As thing? 

 

I almost got the correct way of working through this measure, this allows me to filter on Country and have the Total Sales change for all rows, and then also filter on OwnerName and have the total change for all rows, as intended. But It doesn't work when filtering on a single StoreName. I tried adding it to the ALLEXCEPT but that then gives me the normal sales value

 

CALCULATE(
    SUM(SalesTable[Sales]),
    ALLEXCEPT(StoreTable, StoreTable[Country], StoreTable[OwnerName]),
    USERELATIONSHIP(SalesTable[Date], DateTable[Date])
)

View solution in original post

13 REPLIES 13
v-kpoloju-msft
Community Support
Community Support

Hi @F003Yum,

Thank you for reaching out to the Microsoft fabric community forum. Ans thanks to @AlexTheGreat, for his inputs on this thread. I reproduced the scenario, and it worked on my end. I used my sample data and successfully implemented it.

outcome:

vkpolojumsft_0-1751614634417.png

I am also including .pbix file for your better understanding, please have a look into it:

If this post helps, then please give us ‘Kudos’ and consider Accept it as a solution to help the other members find it more quickly.

Thank you for using Microsoft Community Forum.

@v-kpoloju-msft 

Thanks for the reply!

 

I looked at the solution, and I appreciate the attached file. 

 

But the issue is I need the "Total Sales (Adjusted)" to be affected by filtering on owner.

So in the example you sent:

StoreNameSales AmountTotal Sales (Adjusted)Share of Sales
Nr375013000,58
Nr130013000,23
Nr225013000,19
Total130013001,00

 

So if I select StoreOwner Bob, the table should return like this:

StoreNameSales AmountTotal Sales (Adjusted)Share of Sales
Nr 375010000,75
Nr 225010000,25
Total100010001,0

Hi,

These measures should work

Measure = sum(Data[Sales amount])

Measure 1= calculate([Measure],all(Data[StoreName]))

Measure 2 = divide([measure],[measure 1])

Hope this helps.


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/

Hi @F003Yum,

Thank you for reaching out to the Microsoft fabric community forum. I reproduced the scenario again, and it worked on my end. I used my sample data and successfully implemented it.

Outcome:

vkpolojumsft_0-1751625188871.png

 

So you can change share of sales by using the below option shown in the image:

vkpolojumsft_1-1751625258098.png


I am also including .pbix file for your better understanding, please have a look into it:

If this post helps, then please give us ‘Kudos’ and consider Accept it as a solution to help the other members find it more quickly.

Thank you for using Microsoft Community Forum.

@v-kpoloju-msft 

Thanks again!

That looks good, the thing is I need the measure for another calculation, I then need to multiply it with another related value to get a weighted value. 

So ValueX times Share of Sales = Weighted Value. 

 

I might be wrong but I don't think that'll work when I do the Show Value As thing? 

 

I almost got the correct way of working through this measure, this allows me to filter on Country and have the Total Sales change for all rows, and then also filter on OwnerName and have the total change for all rows, as intended. But It doesn't work when filtering on a single StoreName. I tried adding it to the ALLEXCEPT but that then gives me the normal sales value

 

CALCULATE(
    SUM(SalesTable[Sales]),
    ALLEXCEPT(StoreTable, StoreTable[Country], StoreTable[OwnerName]),
    USERELATIONSHIP(SalesTable[Date], DateTable[Date])
)

Hi @F003Yum.,

Thank you for reaching out to the Microsoft fabric community forum.  I reproduced the scenario again, and it worked on my end. I used my sample data and successfully implemented it.

Outcome:

vkpolojumsft_0-1751655188626.png

 


I am also including .pbix file for your better understanding, please have a look into it:

If this post helps, then please give us ‘Kudos’ and consider Accept it as a solution to help the other members find it more quickly.

Thank you for using Microsoft Community Forum.

AlexTheGreat
Resolver II
Resolver II

Hi,

Unfortunately your image was too pixelated so I made some assumptions of how the relationships would look like.
you should try this measure. Values() is necessary for your filters. I also made the assumption you would have a store owner in your table due to fact you descibe it in the question. 

Total Sales = 
CALCULATE(
SUM(SalesTable[Sales]),
ALL(StoreTable[Store], StoreTable[Owner]),
VALUES(DateTable[Date]),
VALUES(StoreTable[Country])
)

To get your % of shares. Just divide the total with the measure above (this works due to the fact you used values())

Share of Sales = 
DIVIDE(
SUM(SalesTable[Sales]),
[Total Sales]
)

 

Hope it helps! 

@AlexTheGreat 

Thanks for the reply!

 

Sadly this doesn't get me the answer I'm looking for in my file. 

This results in me getting the same amount as [Sales] for each store and day. resulting in always 100% share of sales.

😞

If possible could you get me some dummy data to give it a second try? 
You can upload the Power BI file (no real data please) or paste some dummy data in a table.

As long as I know what we are working on.

 

Thanks in advance and let's figure this out!

@AlexTheGreat 

I'll see if I can prepare something, 

In the meantime, from above:

 

I almost got the correct way of working through this measure, this allows me to filter on Country and have the Total Sales change for all rows, and then also filter on OwnerName and have the total change for all rows, as intended. But It doesn't work when filtering on a single StoreName. I tried adding it to the ALLEXCEPT but that then gives me the normal sales value

 

CALCULATE(
    SUM(SalesTable[Sales]),
    ALLEXCEPT(StoreTableStoreTable[Country]StoreTable[OwnerName]),
    USERELATIONSHIP(SalesTable[Date]DateTable[Date])
)

 

Owh weird,

I tried your measure with @v-kpoloju-msft .pbix file and it works perfectly. Even getting the right answers with selecting a single store. (see below)

AlexTheGreat_0-1751639577869.png

Maybe it has to do something with the relationships of your model?
Check if the relationships are similair to your model. 

Keep me posted!



@AlexTheGreat  

It's so weird, when I tried the measure above in the file @v-kpoloju-msft  provided I don't get same results, I get the normal values per row instead the total, like how it works for my file... 

But it's fine like this I guess... I can try again some other time

Thanks for helping

Hi @F003Yum,

Thanks for the update. No worries at all if it is working well enough for now, that is perfectly fine. And if you decide to revisit it later or want to dig into why the results differ, feel free to reach out to us. Happy to help further whenever you're ready. Really appreciate you taking the time to test and follow up.

Thank you.

Helpful resources

Announcements
FabCon Global Hackathon Carousel

FabCon Global Hackathon

Join the Fabric FabCon Global Hackathon—running virtually through Nov 3. Open to all skill levels. $10,000 in prizes!

October Power BI Update Carousel

Power BI Monthly Update - October 2025

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

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.