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

Get certified in Microsoft Fabric—for free! For a limited time, get a free DP-600 exam voucher to use by the end of 2024. Register now

Reply
randyvdr
Frequent Visitor

total Value with repeated rows

Hello Communitiy,

 

Would you be so gentle to help me with the following query.

 

I have the next example set of data:

 

RegionCountryCategory IDSales order IDTotal Sales
EUROPEItalyAE10 $                    100.00
EUROPEItalyAE10 $                    100.00
EUROPEItalyB  
EUROPEGermanyCE20 $                    150.00
EUROPENorwayDE30 $                    200.00
EUROPENorwayEE30 $                    200.00
ASIAThailandDAS10 $                    300.00
ASIAThailandEAS10 $                    300.00
ASIAJapanGAS20 $                    275.00
ASIAJapanHAS30 $                    225.00
ASIAKoreaIAS40 $                    215.00
ASIAKoreaIAS40 $                    215.00
AFRICANigeriaK  
AFRICANigeriaK  
AFRICAAngolaLAF10 $                    520.00
AFRICAKenyaMAF20 $                    512.00

 

As you can see I have repeated rows of Total Sales, my output should be as following:

 

Sales Order IDTotal_sales_calc
E10 $           100.00
E20 $           150.00
E30 $           200.00
AS10 $           300.00
AS20 $           275.00
AS30 $           225.00
AS40 $           215.00
AF10 $           520.00
AF20 $           512.00
Total $        2,497.00
1 ACCEPTED SOLUTION
vicky_
Super User
Super User

Hi, 

 

Please try the following:

Sales calc = SUMX(SUMMARIZE('Table', 'Table'[Sales order ID], 'Table'[Total Sales]), 'Table'[Total Sales])

Note - for this to work, i assume that each combination of sales order ID and total sales is unique. If you end up with a row that's like:

Region Country Category ID Sales order ID Total Sales
EUROPE Italy A E10  $                    100.00
EUROPE Italy A E10  $                    200.00

then the result in your table will show $300. If this is not the result that you expect, then you will need to provide more details on how you expect to handle this case.

View solution in original post

4 REPLIES 4
randyvdr
Frequent Visitor

Hello community, thanks for all your fast reponses, the results from all three formulas are the following:

 

@vicky_  & @v-denglli-msft  the answers are as expected

 

randyvdr_0-1726068210286.png

 

v-denglli-msft
Community Support
Community Support

Hi @ randyvdr,

 

Thanks to the two Super Users @Ashish_Mathur , @vicky_ for their responses.


You can also try the following DAX to create the Total_sales_calc measure.

Total_sales_calc = 
SUMX(
    DISTINCT('Sales'[Sales order ID]),
    CALCULATE(MAX('Sales'[Total Sales]))
)

 

vdengllimsft_0-1726044363031.png

 

Best Regards,

Dengliang Li

 

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Ashish_Mathur
Super User
Super User

Hi,

These measures work

Min sale = MIN(Data[Total Sales])
Measure = SUMX(VALUES(Data[Sales order ID]),[Min sale])

Hope this helps.

Ashish_Mathur_0-1726013730676.png

 


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

Hi, 

 

Please try the following:

Sales calc = SUMX(SUMMARIZE('Table', 'Table'[Sales order ID], 'Table'[Total Sales]), 'Table'[Total Sales])

Note - for this to work, i assume that each combination of sales order ID and total sales is unique. If you end up with a row that's like:

Region Country Category ID Sales order ID Total Sales
EUROPE Italy A E10  $                    100.00
EUROPE Italy A E10  $                    200.00

then the result in your table will show $300. If this is not the result that you expect, then you will need to provide more details on how you expect to handle this case.

Helpful resources

Announcements
November Carousel

Fabric Community Update - November 2024

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

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.

Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount! Early Bird pricing ends December 9th.

Nov PBI Update Carousel

Power BI Monthly Update - November 2024

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