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

Get Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Request now

Reply
duncanUK
Frequent Visitor

Adding calculated total

I'm quite new to DAX and I'm struggling to add a measure, which I thought should be straightforward, but despite a lot of searching online and testing, I can't achieve the desired result. Any guidance would be very much appreciated!

 

I have a table with budgets and sales by store and department, like this:

 

StoreDeptDateBudgetSales
1A01/04/2021£10£10
1B01/04/2021£20£10
1C01/04/2021£5£10
2A01/04/2021£0£10
2B01/04/2021£0£0
2C01/04/2021£0£0
3A01/04/2021£10£0
3B01/04/2021£20£0
3C01/04/2021£5£0

 

Within reports there are times I need to show the total sales in stores without any budgets (e.g. £10 in store 2), and total budget in stores without any sales (e.g. £35 in store 3).

 

On reports with tables showing the totals by store, it was simple to add a filter to the sales and budget columns, as this was applied at store level. However this didn't work on cards showing the company total, since the filtering was applied to the row level, rather than store level, so was including/excluding rows from store 1.

 

My thinking was to add measures for the total store sales and budgets, then I could filter on these values:

 

StoreDeptDateBudgetSalesStore BudgetStore Sales
1A01/04/2021£10£0£30£20
1B01/04/2021£20£10£30£20
1C01/04/2021£0£10£30£20
2A01/04/2021£0£10£0£10
2B01/04/2021£0£0£0£10
2C01/04/2021£0£0£0£10
3A01/04/2021£10£0£35£0
3B01/04/2021£20£0£35£0
3C01/04/2021£5£0£35£0

 

I can't figure out how to add the Store Budget and Store Sales measures, I was trying the following but this still doesn't work when the Store isn't included on the visual:

 

Store Sales = CALCULATE(SUM(Sales[Sales]), ALLEXCEPT(Sales, Sales[Store]))

 

Any help is appreciated

1 ACCEPTED SOLUTION

Hi,

Sorry that I kept misunderstanding your point.

I am not quite sure how to display the numbers in the table visual and the card visuals.

please check the below link if it is OK with you.

I think the numbers in card visuals are correct. 

If you want to fix the numbers in the table visual, please let me know how to describe it.

Thank you.

 

https://www.dropbox.com/s/h9v89dyyj3fsnty/duncan.pbix?dl=0 


If this post helps, then please consider accepting it as the solution to help other members find it faster, and give a big thumbs up.


Click here to visit my LinkedIn page

Click here to schedule a short Teams meeting to discuss your question.

View solution in original post

49 REPLIES 49
duncanUK
Frequent Visitor

Hi Jihwan,

 

Thanks for your response. I was trying to get the two cards in your example to show:

1) The total sales which have occurred in stores with no budget = £10 in this example

2) The total budget in stores with no sales = £35 in this example

 

Thanks you again for looking at this.

Hi,

Thank you for your feedback.

Sorry that I was misunderstanding your question.

Please try the below two measures for the two card visualizations.

 

Store Sales =
CALCULATE( [Sales], FILTER(Sales, [Budget] = 0))
 
Store Budget =
CALCULATE( [Budget], FILTER( Sales, [Sales]=0))
 

Hi, My name is Jihwan Kim.

If this post helps, then please consider accept it as the solution to help other members find it faster, and give a big thumbs up.


If this post helps, then please consider accepting it as the solution to help other members find it faster, and give a big thumbs up.


Click here to visit my LinkedIn page

Click here to schedule a short Teams meeting to discuss your question.

Hi,

 

Sorry to say but that's not working, as it includes rows from stores where the store level sales or budget > 0, e.g. in this example the measures include rows from store 1:

 

duncanUK_0-1617696583782.png

 

Thanks,

Duncan

Hi,

I thought you were only going to create Card Visualizations for those.

Once again, sorry for my misunderstanding.

 

Please check the below measures and link.

 

Store Sales =
CALCULATE( [Sales], FILTER(ALLEXCEPT(Sales, Sales[Store]), [Budget] = 0))
 
Store Budget =
CALCULATE( [Budget], FILTER(ALLEXCEPT('Sales', 'Sales'[Store]), [Sales]=0))
 
 

Hi, My name is Jihwan Kim.

If this post helps, then please consider accept it as the solution to help other members find it faster, and give a big thumbs up.


If this post helps, then please consider accepting it as the solution to help other members find it faster, and give a big thumbs up.


Click here to visit my LinkedIn page

Click here to schedule a short Teams meeting to discuss your question.

Hello

Yes, I was trying to show them on a card, but the values on the cards are not yet as expected, so I also added them to the grid to look for faults. Note: I changed the data for store 1 of the pbix file.

The total budget in non-sales stores should be £35

Total sales in non-budget stores must be £10

In both cases, it incorrectly includes store 1 rows, which has sales and budget at the store level.

duncanUK_0-1617698093338.png

Thank you again,

Duncan

Hello

Yes, I was trying to show them on a card, but the values on the cards are not yet as expected, so I also added them to the grid to look for faults. Note: I changed the data for store 1 of the pbix file.

The total budget in non-sales stores should be £35

Total sales in non-budget stores must be £10

In both cases, it incorrectly includes store 1 rows, which has sales and budget at the store level.

duncanUK_0-1617698093338.png

Thank you again,

Duncan

Hello

Yes, I was trying to show them on a card, but the values on the cards are not yet as expected, so I also added them to the grid to look for faults. Note: I changed the data for store 1 of the pbix file.

The total budget in non-sales stores should be £35

Total sales in non-budget stores must be £10

In both cases, it incorrectly includes store 1 rows, which has sales and budget at the store level.

duncanUK_0-1617698093338.png

Thank you again,

Duncan

Hello

Yes, I was trying to show them on a card, but the values on the cards are not yet as expected, so I also added them to the grid to look for faults. Note: I changed the data for store 1 of the pbix file.

The total budget in non-sales stores should be £35

Total sales in non-budget stores must be £10

In both cases, it incorrectly includes store 1 rows, which has sales and budget at the store level.

duncanUK_0-1617698093338.png

Thank you again,

Duncan

Hello

Yes, I was trying to show them on a card, but the values on the cards are not yet as expected, so I also added them to the grid to look for faults. Note: I changed the data for store 1 of the pbix file.

The total budget in non-sales stores should be £35

Total sales in non-budget stores must be £10

In both cases, it incorrectly includes store 1 rows, which has sales and budget at the store level.

duncanUK_0-1617698093338.png

Thank you again,

Duncan

Hello

Yes, I was trying to show them on a card, but the values on the cards are not yet as expected, so I also added them to the grid to look for faults. Note: I changed the data for store 1 of the pbix file.

The total budget in non-sales stores should be £35

Total sales in non-budget stores must be £10

In both cases, it incorrectly includes store 1 rows, which has sales and budget at the store level.

duncanUK_0-1617698093338.png

Thank you again,

Duncan

Hello

Yes, I was trying to show them on a card, but the values on the cards are not yet as expected, so I also added them to the grid to look for faults. Note: I changed the data for store 1 of the pbix file.

The total budget in non-sales stores should be £35

Total sales in non-budget stores must be £10

In both cases, it incorrectly includes store 1 rows, which has sales and budget at the store level.

duncanUK_0-1617698093338.png

Thank you again,

Duncan

Hello

Yes, I was trying to show them on a card, but the values on the cards are not yet as expected, so I also added them to the grid to look for faults. Note: I changed the data for store 1 of the pbix file.

The total budget in non-sales stores should be £35

Total sales in non-budget stores must be £10

In both cases, it incorrectly includes store 1 rows, which has sales and budget at the store level.

duncanUK_0-1617698093338.png

Thank you again,

Duncan

Hello

Yes, I was trying to show them on a card, but the values on the cards are not yet as expected, so I also added them to the grid to look for faults. Note: I changed the data for store 1 of the pbix file.

The total budget in non-sales stores should be £35

Total sales in non-budget stores must be £10

In both cases, it incorrectly includes store 1 rows, which has sales and budget at the store level.

duncanUK_0-1617698093338.png

Thank you again,

Duncan

Hello

Yes, I was trying to show them on a card, but the values on the cards are not yet as expected, so I also added them to the grid to look for faults. Note: I changed the data for store 1 of the pbix file.

The total budget in non-sales stores should be £35

Total sales in non-budget stores must be £10

In both cases, it incorrectly includes store 1 rows, which has sales and budget at the store level.

duncanUK_0-1617698093338.png

Thank you again,

Duncan

Hello

Yes, I was trying to show them on a card, but the values on the cards are not yet as expected, so I also added them to the grid to look for faults. Note: I changed the data for store 1 of the pbix file.

The total budget in non-sales stores should be £35

Total sales in non-budget stores must be £10

In both cases, it incorrectly includes store 1 rows, which has sales and budget at the store level.

duncanUK_0-1617698093338.png

Thank you again,

Duncan

Hello

Yes, I was trying to show them on a card, but the values on the cards are not yet as expected, so I also added them to the grid to look for faults. Note: I changed the data for store 1 of the pbix file.

The total budget in non-sales stores should be £35

Total sales in non-budget stores must be £10

In both cases, it incorrectly includes store 1 rows, which has sales and budget at the store level.

duncanUK_0-1617698093338.png

Thank you again,

Duncan

Hello

Yes, I was trying to show them on a card, but the values on the cards are not yet as expected, so I also added them to the grid to look for faults. Note: I changed the data for store 1 of the pbix file.

The total budget in non-sales stores should be £35

Total sales in non-budget stores must be £10

In both cases, it incorrectly includes store 1 rows, which has sales and budget at the store level.

duncanUK_0-1617698093338.png

Thank you again,

Duncan

Hello

Yes, I was trying to show them on a card, but the values on the cards are not yet as expected, so I also added them to the grid to look for faults. Note: I changed the data for store 1 of the pbix file.

The total budget in non-sales stores should be £35

Total sales in non-budget stores must be £10

In both cases, it incorrectly includes store 1 rows, which has sales and budget at the store level.

duncanUK_0-1617698093338.png

Thank you again,

Duncan

Hello

Yes, I was trying to show them on a card, but the values on the cards are not yet as expected, so I also added them to the grid to look for faults. Note: I changed the data for store 1 of the pbix file.

The total budget in non-sales stores should be £35

Total sales in non-budget stores must be £10

In both cases, it incorrectly includes store 1 rows, which has sales and budget at the store level.

duncanUK_0-1617698093338.png

Thank you again,

Duncan

Hello

Yes, I was trying to show them on a card, but the values on the cards are not yet as expected, so I also added them to the grid to look for faults. Note: I changed the data for store 1 of the pbix file.

The total budget in non-sales stores should be £35

Total sales in non-budget stores must be £10

In both cases, it incorrectly includes store 1 rows, which has sales and budget at the store level.

duncanUK_0-1617698093338.png

Thank you again,

Duncan

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
Users online (10,291)