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

Division Quick Measure Issue

Hi there,

 

I am having an issue creating a quick measure. For example I am trying to divide Total Sales $ for Location Description by Total Linear. However, some locations have multiple SKUS in the underlying data.

 

For example, "Asst Squishmallows" has total lienar repeated 7 times causing it to divide Total Sales $ by 31.5 (4.5x7) not 4.5. I have also tried to link location description to another table but it causing a similar error. Is there a simple formula fix to this?

 

Essentially, I want all of the Sales $ to sum for the location description as it has been but only by the total linaer for the location description ($189,541/4.5).

 

Thanks for the help!

 

SharedScreenshot1.jpgSharedScreenshot2.jpg

1 ACCEPTED SOLUTION
v-lili6-msft
Community Support
Community Support

hi @Anonymous 

It looks like a measure totals problem. Very common. See this post about it
https://community.powerbi.com/t5/DAX-Commands-and-Tips/Dealing-with-Measure-Totals/td-p/63376

Also, this Quick Measure, Measure Totals, The Final Word should get you what you need:
https://community.powerbi.com/t5/Quick-Measures-Gallery/Measure-Totals-The-Final-Word/m-p/547907

 

For your case, you could use this formula

Measure = 
DIVIDE(SUM('Table'[Sales $]), 
SUMX(SUMMARIZE('Table','Table'[Location Description],'Table'[Total Linear]),[Total Linear])
       )

 

or this simple formula

Measure 2 = DIVIDE(SUM('Table'[Sales $]), AVERAGE('Table'[Total Linear]))

Result:

4.JPG5.JPG

 

and here is a simple sample pbix file, please try it.

 

Regards,

Lin

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

View solution in original post

2 REPLIES 2
v-lili6-msft
Community Support
Community Support

hi @Anonymous 

It looks like a measure totals problem. Very common. See this post about it
https://community.powerbi.com/t5/DAX-Commands-and-Tips/Dealing-with-Measure-Totals/td-p/63376

Also, this Quick Measure, Measure Totals, The Final Word should get you what you need:
https://community.powerbi.com/t5/Quick-Measures-Gallery/Measure-Totals-The-Final-Word/m-p/547907

 

For your case, you could use this formula

Measure = 
DIVIDE(SUM('Table'[Sales $]), 
SUMX(SUMMARIZE('Table','Table'[Location Description],'Table'[Total Linear]),[Total Linear])
       )

 

or this simple formula

Measure 2 = DIVIDE(SUM('Table'[Sales $]), AVERAGE('Table'[Total Linear]))

Result:

4.JPG5.JPG

 

and here is a simple sample pbix file, please try it.

 

Regards,

Lin

Community Support Team _ Lin
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
BA_Pete
Super User
Super User

Hi @Anonymous ,

 

There's two ways that I can think to go about this:

 

1) Group the table in Power Query before doing any calculations i.e. select any columns that have duplicated rather than unique values e.g. [Licence], [Location #], [Location Desc], [Total Linear] etc. then 'Group By' on the Home tab. In the UI that opens, select how you want to aggregate each of the unique value columns (probably SUM for each).

 

2) A bit messier: you could include the count of duplicated rows within your measure to divide [Total Linear] by to get back to the single value, something along these lines may work:

_salesPerLinear =
VAR __linear =
DIVIDE(
  SUM([Total Linear]),
  COUNT([Location Desc]),
  0
)
RETURN
DIVIDE(
  SUM([Sales $]),
  __linear,
  0
)

 

However, I think this second option will only really work if you're adding context back in by reporting in a table with [Location Desc].

 

Pete



Now accepting Kudos! If my post helped you, why not give it a thumbs-up?

Proud to be a Datanaut!




Helpful resources

Announcements
LearnSurvey

Fabric certifications survey

Certification feedback opportunity for the community.