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

Compete to become Power BI Data Viz World Champion! First round ends August 18th. Get started.

Reply
Anonymous
Not applicable

help to calculate sales for each product

hi i am new to power bi and Dax , i need a little help i have a table with rents of different Properties .Structure of table is as follows :

Properties :

PropertyID |   RentPerMonth |   Month(date)  

----------------------------------
i want to see total revnue for each property ID

eg if  i have 2 properties eg 

prp1  |200 | July 2009
prp1  |300  | August 2009
prp1  |250  | september 2009
prp2  |215 | July 2009
prp2  |275  | August 2009
prp2 |288 | september 2009

now for each  property id  i want to see its total revnue generated ,secocdaly i want to see standard deviation against each property id

 

Note : I dont want to total sales  for all products , i want to see sales for each product ID so i can see them on any visual


 



 

1 ACCEPTED SOLUTION

You send me the formula for standard deviation so I rebuild it in DAX for you so you can understand it. If you check the formula you posted, you will see -1 too.

 

You can find the full explanation of ALLEXCEPT here;

https://docs.microsoft.com/en-us/dax/allexcept-function-dax

 

View solution in original post

19 REPLIES 19
Anonymous
Not applicable

2019-06-19_21h45_18.png

 

 

 

 

 

 

 

 

 

 

 

 

 

I hope this is what your after:

Stdev (In Property) = CALCULATE(STDEV.S(Table1[Value]),ALLEXCEPT('Table1',Table1[Property]))
Avg (In Property) = CALCULATE(AVERAGE('Table1'[Value]),ALLEXCEPT('Table1',Table1[Property]))

 

parry2k
Super User
Super User

@Anonymous in your post what you refer to product?? It is not very clear?



Subscribe to the @PowerBIHowTo YT channel for an upcoming video on List and Record functions in Power Query!!

Learn Power BI and Fabric - subscribe to our YT channel - Click here: @PowerBIHowTo

If my solution proved useful, I'd be delighted to receive Kudos. When you put effort into asking a question, it's equally thoughtful to acknowledge and give Kudos to the individual who helped you solve the problem. It's a small gesture that shows appreciation and encouragement! ❤


Did I answer your question? Mark my post as a solution. Proud to be a Super User! Appreciate your Kudos 🙂
Feel free to email me with any of your BI needs.

Anonymous
Not applicable

By product I mean property

I want to see total sales and standard deviation for each unique property
avanderschilden
Resolver I
Resolver I

Hello,

 

Create a simple measure like SUM(RentPerMonth), drag the measure into a column chart, and drag property id on the axis.

 

Regards,

Adrian

Anonymous
Not applicable

And same for standard deviation?

Use it's dax formula ?

What do you think about this?

 

Capture.PNG

Anonymous
Not applicable

StandardDev = STDEV.P('fiverr_db monthly_mar_19'[RevenueUSD])

i used this is it fine??

I can not confirm that, because it produces a weird result in my data set;

 

Capture.PNG

Anonymous
Not applicable

same here confused...

and standard deviation formula is way complex

image.png

I'm glad I could help

Anonymous
Not applicable

so what you suggest ? need your suggestion

Here you go;

 

Capture.PNG

Anonymous
Not applicable

can you please share formulas for delta AND  squared delta and all calculation you did 🙂

i want to try with my data 🙂

Total Rent =
SUM('Property'[Rent])
 
Average Rent =
CALCULATE(AVERAGE('Property'[Rent]),ALL('Property'))
 
Delta =
[Total Rent]-[Average Rent]
 
Squared Delta =
[Delta]*[Delta]
 
St Dev =
SQRT(DIVIDE([Squared Delta],CALCULATE(COUNTROWS('Property'),ALL('Property'))-1))
Anonymous
Not applicable

just a random thought average of rent will be giving average of all rents for all property ids. right?

its not showing average  rent for each property am i right?

That's correct. As you can see in the screenshots the average is equal on all rows.

 

If you want to use the average of a property you can change the measure into;

 

Capture.PNG

 

And also change the St Dev measure into;

 
SQRT(DIVIDE([Squared Delta],CALCULATE(COUNTROWS('Property'),ALLEXCEPT('Property','Property'[Property]))-1))
Anonymous
Not applicable

and just for sake of understanding...what is the use of this allexcept and that subtraction(-1) in end

what that subtraction do..

Sorry for asking so many lame questions , Actually i am new to power bi and dax and i want to polish my skills in this field

You send me the formula for standard deviation so I rebuild it in DAX for you so you can understand it. If you check the formula you posted, you will see -1 too.

 

You can find the full explanation of ALLEXCEPT here;

https://docs.microsoft.com/en-us/dax/allexcept-function-dax

 

Anonymous
Not applicable

and*(Total rent ) sum will be changed in similar manner to show sum for each proerty ,rather then showing for all

Helpful resources

Announcements
August Power BI Update Carousel

Power BI Monthly Update - August 2025

Check out the August 2025 Power BI update to learn about new features.

August 2025 community update carousel

Fabric Community Update - August 2025

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