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

To celebrate FabCon Vienna, we are offering 50% off select exams. Ends October 3rd. Request your discount now.

Reply
alexa_0028
Resolver II
Resolver II

Grand total not matching in table/matrix

Hi All,

I have measure like below :

IS PY-2 = CALCULATE([Sales],filter('C Account','C Account'[C. Account Code (CAC)]IN VALUES (parents[code]) ),filter('Product','Product'[P. Code]IN VALUES(products_los[Product Code])),'Calendar'[py_min2_flag]=1,'M Sales'[flag_sample]=0)

I am trying to rewrite my DASX but my grandtotal is not matching.
Proposed_IS PY-2 =
var is_py_min_2 = CALCULATE([Sales ],filter('C Account',' C Account'[C. Account Code (CAC)]IN VALUES (parents[code]) ),filter('Product','Product'[P. Code]IN VALUES(products_los[Product Code])),'Calendar'[py_min2_flag]=1,'M Sales'[flag_sample]=0)
RETURN
IF ( HASONEFILTER('parents'[Group]), is_py_min_2,SUMX(VALUES(parents[Group]),is_py_min_2))

alexa_0028_0-1633003775159.png

 


Model :

alexa_0028_1-1633004407021.png

 

1 ACCEPTED SOLUTION
alexa_0028
Resolver II
Resolver II

Hi All, 
I got the results by first creating a measure and then creating second measure to apply grand total.
I also made the relationship as bidirectional for product_los table.
SUMX(KEEPFILTERS()) was the key thing to use as I want my table to keep the filters from the other column.

Proposed_IS PY-2 =
var is_py_min_2 = CALCULATE([Sales ],filter('C Account',' C Account'[C. Account Code (CAC)]IN VALUES (parents[code]) ),filter('Product','Product'[P. Code]IN VALUES(products_los[Product Code])),'Calendar'[py_min2_flag]=1,'M Sales'[flag_sample]=0)

grand_total_fix=
IF ( HASONEFILTER('parents'[Group]), [Proposed_IS PY-2],SUMX(KEEPFILTERS(VALUES(product_los[LOS])),[Proposed_IS PY-2]))

View solution in original post

5 REPLIES 5
alexa_0028
Resolver II
Resolver II

Hi All, 
I got the results by first creating a measure and then creating second measure to apply grand total.
I also made the relationship as bidirectional for product_los table.
SUMX(KEEPFILTERS()) was the key thing to use as I want my table to keep the filters from the other column.

Proposed_IS PY-2 =
var is_py_min_2 = CALCULATE([Sales ],filter('C Account',' C Account'[C. Account Code (CAC)]IN VALUES (parents[code]) ),filter('Product','Product'[P. Code]IN VALUES(products_los[Product Code])),'Calendar'[py_min2_flag]=1,'M Sales'[flag_sample]=0)

grand_total_fix=
IF ( HASONEFILTER('parents'[Group]), [Proposed_IS PY-2],SUMX(KEEPFILTERS(VALUES(product_los[LOS])),[Proposed_IS PY-2]))
v-henryk-mstf
Community Support
Community Support

Hi @alexa_0028 ,

 

Please provide the relevant information and test data according to the following blog content, and I will answer you as soon as possible.

 

How to Get Your Question Answered Quickly - Microsoft Power BI Community


Looking forward to your reply.


Best Regards,
Henry

 

alexa_0028
Resolver II
Resolver II

Hi @vanessafvg 
thanks for sharing the link
I updated my DASX and still i am getting incorrect result

Proposed_IS PY-2 =
var is_py_min_2 = CALCULATE([Sales],filter('C Account','C Account'[C. Account Code (CAC)] IN VALUES (parents[code]) ),filter('Product','Product'[P. Code]IN VALUES(products_los[Product Code])),'Calendar'[py_min2_flag]=1,'M Sales'[flag_sample]=0)
RETURN
SUMX(
SUMMARIZE('parents',[Group], "test",is_py_min_2),[test])

its really  hard to read what you are doing, if you are able to suppy data in text format that would be better.

 

also when you say it is wrong which is correct?  you need to provide more information if you need help

providing sample data 

explaining which total you expecting

explain what you trying to do from a business requirement perspective

explaning where the error is





If I took the time to answer your question and I came up with a solution, please mark my post as a solution and /or give kudos freely for the effort 🙂 Thank you!

Proud to be a Super User!




vanessafvg
Super User
Super User

you need to understand how power bi works, this video explains why totals dont always match. In your second calc you are using an iterator so that is probably why

https://www.youtube.com/watch?v=Rii_6qkLNh8





If I took the time to answer your question and I came up with a solution, please mark my post as a solution and /or give kudos freely for the effort 🙂 Thank you!

Proud to be a Super User!




Helpful resources

Announcements
September Power BI Update Carousel

Power BI Monthly Update - September 2025

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

Top Kudoed Authors