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

sum per product

Hi  

 

I have this data example 

data.PNG

 

 

and this should be the result

 

 

result.PNG

 

I know you can do it by slicers but i would like to get a formula which will basicaly do anual sale per product 

 

thank you 

 

4 REPLIES 4
v-shex-msft
Community Support
Community Support

Hi @Anonymous,

 

You can try to use below formula to calculate the total value of each product.

 

Measures:

Sum of each product 2017=
var currProduct= LASTNOBLANK(Table[Product],[Product])
return
SUMX(FILTER(ALL(Table),[Product]=currProduct),[Units sold 2017])

Sum of each product 2016=
var currProduct= LASTNOBLANK(Table[Product],[Product])
return
SUMX(FILTER(ALL(Table),[Product]=currProduct),[Units sold 2016])

 

In addition, you can also use summarzie function to get the summary table.

 

Table formula:

 

Summary Table= SUMMARIZE(Table,[Product],"Sum 2017",SUM(Table[Units sold 2017]),"Sum 2016",SUM(Table[Units sold 2016]))

 

 

Regards,

Xiaoxin Sheng

Community Support Team _ Xiaoxin
If this post helps, please consider accept as solution to help other members find it more quickly.
Anonymous
Not applicable

 

@v-shex-msft

 

I feel I am getting closer 

 

when i tried the formula for the table i got a two numbers .. so basicaly total sale for 2016 and 2017.

what I need is to have the sale per product but i would like to have it as meassure 

lets say

                            2017              2016

Jordan                 23                    137

Airmax                 14                   18

Airforce               16                     5

Nike Dunk           2                      45

 

i tried something like this but it doesnt really work. 

sales per product 17=

var uniqueproduct=DISTINCT('table'[product])

return

sumx(filter('table',[product]=uniqueproduct),[units sold 2017]))

 

thank you 

Hi @Anonymous,

 

>>when i tried the formula for the table i got a two numbers 

If you create a table visual and add these measures to it, the visual will auto summary by each product.(if you drag them to card visual it only show two value)

 

Regards,

Xiaoxin Sheng

Community Support Team _ Xiaoxin
If this post helps, please consider accept as solution to help other members find it more quickly.
ibarrau
Super User
Super User

I'm not sure I get the problem here.

 

If you already have the years, just make a matrix with product as rows and sum of Unit Sold2016 and Unit Sold2017 as values. 

The normal way to go is to have amounts and years in two columns and not a columns for each year. In that case, make a matrix with product as rows, years as column and sum of amount as values.

 

Hope this helps.

Regards,


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

Happy to help!

LaDataWeb Blog

Helpful resources

Announcements
RTI Forums Carousel3

New forum boards available in Real-Time Intelligence.

Ask questions in Eventhouse and KQL, Eventstream, and Reflex.

MayPowerBICarousel

Power BI Monthly Update - May 2024

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

LearnSurvey

Fabric certifications survey

Certification feedback opportunity for the community.