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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
Anonymous
Not applicable

Calculate % of the average per location based on the location area

I am trying to do the below highlighted calculations and wasn’t quite sure how use DAX to do the calculations.

 

I want for pull the area average per each location (i.e per each row) suing DAX and then to get the turnover % by dividing column D by column E  which is easier but my challenge is to pull each area average against each location.

 

I hsve also included a sample data set.

 

Any help is greatly appreciated.

image.png

 

 

LocationAreaGame NameTurnover Per MachineAvg Turnover By AreaTrunover %
AA01RegularGame A $7,278$8,581.7985%
AA02RegularGame B$8,440$8,581.7998%
AA03RegularGame A $6,689$8,581.7978%
AA04RegularGame C$8,946$8,581.79104%
AA05RegularGame D$10,463$8,581.79122%
AA06RegularGame B$9,889$8,581.79115%
AA07RegularGame B$7,565$8,581.7988%
AA08RegularGame C$9,935$8,581.79116%
AA09RegularGame A $6,556$8,581.7976%
AA10RegularGame C$10,223$8,581.79119%
AA11RegularGame C$10,191$8,581.79119%
AA12RegularGame D$10,909$8,581.79127%
AA13RegularGame B$7,713$8,581.7990%
AA14RegularGame B$5,348$8,581.7962%
VV01PremiumGame B$7,279$8,008.5691%
VV02PremiumGame D$10,603$8,008.56132%
VV03PremiumGame D$5,913$8,008.5674%
VV04PremiumGame D$9,171$8,008.56115%
VV05PremiumGame A $5,657$8,008.5671%
VV06PremiumGame D$7,249$8,008.5691%
VV07PremiumGame C$8,329$8,008.56104%
VV08PremiumGame B$9,108$8,008.56114%
VV09PremiumGame C$8,768$8,008.56109%
XX01VIPGame B$9,887$11,192.6988%
XX02VIPGame C$7,636$11,192.6968%
XX03VIPGame A $8,385$11,192.6975%
XX04VIPGame D$11,165$11,192.69100%
XX05VIPGame A $17,507$11,192.69156%
XX06VIPGame D$17,800$11,192.69159%
XX07VIPGame C$7,012$11,192.6963%
XX08VIPGame D$12,170$11,192.69109%
XX09VIPGame A $9,794$11,192.6988%
XX10VIPGame A $7,901$11,192.6971%
XX11VIPGame A $11,759$11,192.69105%
XX12VIPGame C$16,618$11,192.69148%
XX13VIPGame D$7,871$11,192.6970%
1 ACCEPTED SOLUTION
stevedep
Memorable Member
Memorable Member

Hi,

 

__AvgTurnOverbyArea = CALCULATE(AVERAGE('Table'[Turnover Per Machine]),ALLEXCEPT('Table','Table'[Area]))

___TurnOverPerc = SUM('Table'[Turnover Per Machine])/[__AvgTurnOverbyArea]

turnover.png

Link to file

Please mark as solution if so. Thumbs up for the effort are appreciated.

Kind regards, 
Steve.  

View solution in original post

8 REPLIES 8
Ashish_Mathur
Super User
Super User

Hi,

If Turnover per machine is a column already present in your dataset, then try this calculated column formula

=CALCULATE(AVERAGE(Data[Turnover Per Machine]),FILTER(Data,Data[Area]=EARLIER(Data[Area])))

Hope this helps.

Untitled.png


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/
Anonymous
Not applicable

@Ashish_Mathur  

no its not in the data set and it needs to calculate using another DAX.

The orginal data set has a date column as well and using that fromula i am getting  different answer.

Is there a way I can share the data set with you ?

 

Thanks,

 

Deevs

 

 

 

Hi,

Share the download link of the file.


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/
Anonymous
Not applicable

@Ashish_Mathur 

 

How do i do that as there is no option to upload a excel or a pbix file here and I don't have one drive either. Can I send you via linkedin ?

 

Hi,

Try Google Drive.


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

@Anonymous , Try one of the two

 

// this should consider filters
divide(sum(Table[Turnover Per Machine]),calculate(sum(Table[Turnover Per Machine]), filter(allselected([Table]),Table[Area] =max(Table[Area]))))

 

 

divide(sum(Table[Turnover Per Machine]),calculate(sum(Table[Turnover Per Machine]), allexcept([Table],Table[Area] )))

stevedep
Memorable Member
Memorable Member

Hi,

 

__AvgTurnOverbyArea = CALCULATE(AVERAGE('Table'[Turnover Per Machine]),ALLEXCEPT('Table','Table'[Area]))

___TurnOverPerc = SUM('Table'[Turnover Per Machine])/[__AvgTurnOverbyArea]

turnover.png

Link to file

Please mark as solution if so. Thumbs up for the effort are appreciated.

Kind regards, 
Steve.  

Anonymous
Not applicable

@stevedep 

Can I send you the data set I am working on as the “turnover per machine” column on the data I uploaded was also need to be calculated. The way I calculate the Turnover per Machine is by dividing Turnover by location count for a given period.

Your formula working perfectly fine for the data set I uploaded and now I am trying to figure how to do the turnover per mac calculation on the same DAX formula.

 

Any chance I can directly message you the data set I am working on as there is no option to upload a large data set here in an excel format.

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

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.