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

Earn a 50% discount on the DP-600 certification exam by completing the Fabric 30 Days to Learn It challenge.

Reply
Anonymous
Not applicable

how to get the sum of different values using dax

Hello Team,

My data has SKUs and their quantities. For example:

RegionSkuQty
R1SKU1300
R2SKU1300
R3SKU1300
R1SKU2500
R2SKU2500
R3SKU2500
R4SKU2500
R5SKU2500

Let's say I'm showing this data in a line chart and not taking into account the regions I have.

I want to show the sum of the sale of quantities other than SKUs and not sum all of these. For example: I would like to show the total use of SKUs is (300+500 to 800).

But right now if I'm summarizing the column, I'm getting full sum like 500*5+300*3 (which is obvious).

Is there any way through which I can achieve the total amounts to be 800 apart from the other number.

Also, making an average will not work as SKUs are not repeated equally number of times. There could be 2 or more SKUs with the same amount, so you want to make sure that both quantities are added

Thank you in advance

@Greg_Deckler @amitchandak @ImkeF

1 ACCEPTED SOLUTION
amitchandak
Super User
Super User

@RohanChhabra ,

Please try as a

sumx(summarize(table,table[SKU],"_max",max(table[QTY])),[_max])

View solution in original post

6 REPLIES 6
Anonymous
Not applicable

Thanks a lot everybody for helping.

However, I tried the method shared by @amitchandak and it worked for me

 

Again, thanks y'all for providing your solutions.

 

Best Regards,

Rohan

 

v-yiruan-msft
Community Support
Community Support

Hi @Anonymous ,

You can create one measure as below:

Sum of distinct values = SUMX(SUMMARIZE(DISTINCT('table'[SKU]),'table'[SKU],"Quantity",DISTINCT('table'[Qty])),[Quantity])

sum of distinct values.JPG

Best Regards

Rena

Community Support Team _ Rena
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,

Write these measures

Quantity = MIN('Table'[Qty])

Measure = SUMX(VALUES('Table'[SKU]),[Quantity])

Hope this helps.


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

@RohanChhabra ,

Please try as a

sumx(summarize(table,table[SKU],"_max",max(table[QTY])),[_max])

Thanks a lot

Tahreem24
Super User
Super User

Try below Dax measure:
Measure = Calculate(sum(Table[Qty]), AllExcept(Table, Table[SKU]))

Don't forget to give Thumbs up and accept this as a solution if it helped you.
Don't forget to give thumbs up and accept this as a solution if it helped you!!!

Please take a quick glance at newly created dashboards : Restaurant Management Dashboard , HR Analytics Report , Hotel Management Report, Sales Analysis Report , Fortune 500 Companies Analysis , Revenue Tracking Dashboard

Helpful resources

Announcements
LearnSurvey

Fabric certifications survey

Certification feedback opportunity for the community.

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

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

April Fabric Community Update

Fabric Community Update - April 2024

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