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

Shape the future of the Fabric Community! Your insights matter. That’s why we created a quick survey to learn about your experience finding answers to technical questions. Take survey.

Reply
islam_zaki
Regular Visitor

SUMX total incorrect

Hi

 

I need to get the Customer Count bassed on two factors, First is "terminal number" and second is "Transaction Number". each factor repeated in the same invoice with each barcode. 

I create on DAX giving me the correct value for each terminal per store per day. but the total of the day or total of the store for the period is incorrect. I have to retune to filter by date and store. 

Please can anyone help regarding below DAX statement? 

 

Customer Count =
SUMX (
VALUES ( SALESTRANSACTION[TERMINAL #] ),
CALCULATE ( DISTINCTCOUNT ( SALESTRANSACTION[TRX #]))
)
 
 
Thanks 
 
Best Regards
1 ACCEPTED SOLUTION

Firstly, Thanks @amitchandak 

 

The statement you shared it's correctly in addition to table name and two more columns "STORE #" and "AREA".

the Final statement below: 

 

Customer Count =
SUMX (
SUMMARIZE ( SALESTRANSACTION,
SALESTRANSACTION[STORE #],SALESTRANSACTION[AREA],SALESTRANSACTION[TERMINAL #],SALESTRANSACTION[SALES DATE],"_1",
CALCULATE ( DISTINCTCOUNT ( SALESTRANSACTION[TRX #]))),[_1]
)
 
But what I didn't understand "_1", what does it mean...
 
Thanks 
 
Best Regards,
Islam Zaki

View solution in original post

2 REPLIES 2
amitchandak
Super User
Super User

@islam_zaki , Try like

Customer Count =
SUMX (
summarize ( SALESTRANSACTION[TERMINAL #] ,SALESTRANSACTION[Date] ,"_1",
CALCULATE ( DISTINCTCOUNT ( SALESTRANSACTION[TRX #]))),[_1]
)

 

Can you share sample data and sample output in table format?

Join us as experts from around the world come together to shape the future of data and AI!
At the Microsoft Analytics Community Conference, global leaders and influential voices are stepping up to share their knowledge and help you master the latest in Microsoft Fabric, Copilot, and Purview.
️ November 12th-14th, 2024
 Online Event
Register Here

Firstly, Thanks @amitchandak 

 

The statement you shared it's correctly in addition to table name and two more columns "STORE #" and "AREA".

the Final statement below: 

 

Customer Count =
SUMX (
SUMMARIZE ( SALESTRANSACTION,
SALESTRANSACTION[STORE #],SALESTRANSACTION[AREA],SALESTRANSACTION[TERMINAL #],SALESTRANSACTION[SALES DATE],"_1",
CALCULATE ( DISTINCTCOUNT ( SALESTRANSACTION[TRX #]))),[_1]
)
 
But what I didn't understand "_1", what does it mean...
 
Thanks 
 
Best Regards,
Islam Zaki

Helpful resources

Announcements
November Carousel

Fabric Community Update - November 2024

Find out what's new and trending in the Fabric Community.

Dec Fabric Community Survey

We want your feedback!

Your insights matter. That’s why we created a quick survey to learn about your experience finding answers to technical questions.

Nov PBI Update Carousel

Power BI Monthly Update - November 2024

Check out the November 2024 Power BI update to learn about new features.

Live Sessions with Fabric DB

Be one of the first to start using Fabric Databases

Starting December 3, join live sessions with database experts and the Fabric product team to learn just how easy it is to get started.