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! Learn more

Reply
mh2587
Super User
Super User

Measure total is not correct

del count.PNG

In the I just distinctcount one of the column but in matrix the total is incorrect

Single Table Sales_transaction 
columns :  Customer Key , Document type , Net Amount 
Dax :

Customer Deliveries 2.1 = var table_ = SUMMARIZE(SALES_DOCUMENTS,
SALES_DOCUMENTS[CUSTOMER_KEY],

 

"Deliveries",CALCULATE(DISTINCTCOUNT(SALES_DOCUMENTS[CUSTOMER_KEY]),SALES_DOCUMENTS[DOCUMENT_TYPE] IN {"SI","SO"},SALES_DOCUMENTS[NET_AMOUNT] > 1)) return SUMX(table_,[Deliveries])
 
But returning total is not correct in matrix 

Did I answer your question? If so, please mark my post as a solution!


Proud to be a Super User!




LinkedIn Icon
Muhammad Hasnain



1 ACCEPTED SOLUTION
Anonymous
Not applicable

Hi @mh2587 ,

 

Please try calculating the value of the total column separately.

SUMX(ALLSELECTED(table),[Customer Deliveries])

Use ISINSCOPE() function to determine whether it is a total column and return different value.

measure = IF(ISINSCOPE([Column filed]),[Customer Deliveries],SUMX(ALLSELECTED(table),[Customer Deliveries]))

If I misunderstood your meaning, please share some sample data and expected result.

 

Best Regards,

Jay

View solution in original post

7 REPLIES 7
mh2587
Super User
Super User

Single Table Sales_transaction 
columns :  Customer Key , Document type , Net Amount 
Dax :

Customer Deliveries 2.1 = var table_ = SUMMARIZE(SALES_DOCUMENTS,
SALES_DOCUMENTS[CUSTOMER_KEY],

 

"Deliveries",CALCULATE(DISTINCTCOUNT(SALES_DOCUMENTS[CUSTOMER_KEY]),SALES_DOCUMENTS[DOCUMENT_TYPE] IN {"SI","SO"},SALES_DOCUMENTS[NET_AMOUNT] > 1)) return SUMX(table_,[Deliveries])
 
But returning total is not correct in matrix 

Did I answer your question? If so, please mark my post as a solution!


Proud to be a Super User!




LinkedIn Icon
Muhammad Hasnain



Anonymous
Not applicable

Hi @mh2587 ,

 

Please try calculating the value of the total column separately.

SUMX(ALLSELECTED(table),[Customer Deliveries])

Use ISINSCOPE() function to determine whether it is a total column and return different value.

measure = IF(ISINSCOPE([Column filed]),[Customer Deliveries],SUMX(ALLSELECTED(table),[Customer Deliveries]))

If I misunderstood your meaning, please share some sample data and expected result.

 

Best Regards,

Jay

Greg_Deckler
Community Champion
Community Champion

@mh2587 This looks like a measure totals problem. Very common. See my post about it here: https://community.powerbi.com/t5/DAX-Commands-and-Tips/Dealing-with-Measure-Totals/td-p/63376

Also, this Quick Measure, Measure Totals, The Final Word should get you what you need:
https://community.powerbi.com/t5/Quick-Measures-Gallery/Measure-Totals-The-Final-Word/m-p/547907



Follow on LinkedIn
@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
DAX For Humans

DAX is easy, CALCULATE makes DAX hard...
amitchandak
Super User
Super User

@mh2587 , Distinctcount can be different in grand total. As that is not sum of rows

 

Other wise force it using the column in visual

 

sumx(addcolumns(summarize(Table, Table[Column]), "_1", distinctcount(Table[Col2])), [_1])

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

Customer Deliveries 2.1 = var table_ = SUMMARIZE(SALES_DOCUMENTS,
SALES_DOCUMENTS[CUSTOMER_KEY],

"Deliveries",CALCULATE(DISTINCTCOUNT(SALES_DOCUMENTS[CUSTOMER_KEY]),SALES_DOCUMENTS[DOCUMENT_TYPE] IN {"SI","SO"},SALES_DOCUMENTS[NET_AMOUNT] > 1)) return SUMX(table_,[Deliveries])
I tried this approach as well but can't get the desire output

Did I answer your question? If so, please mark my post as a solution!


Proud to be a Super User!




LinkedIn Icon
Muhammad Hasnain



@mh2587 Is your table visual also summarized by CUSTOMER_KEY only? As in, you only have CUSTOMER_KEY column and Deliver 2 measure in your table? I would do it this way:

Customer Deliveries 2.1 = 
  var table_ = SUMMARIZE(SALES_DOCUMENTS, SALES_DOCUMENTS[CUSTOMER_KEY],
    "Deliveries", [Delivery 2])
RETURN
  IF(HASONEVALUE(SALES_DOCUMENTS[CUSTOMER_KEY]),[Delivery 2],SUMX(table_,[Deliveries]))

So use your existing measure that you know works for individual lines.



Follow on LinkedIn
@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
DAX For Humans

DAX is easy, CALCULATE makes DAX hard...

Still I get the same result not working


Did I answer your question? If so, please mark my post as a solution!


Proud to be a Super User!




LinkedIn Icon
Muhammad Hasnain



Helpful resources

Announcements
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!

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.

Top Solution Authors