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.
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!
Solved! Go to Solution.
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:
and here is a simple sample pbix file, please try it.
Regards,
Lin
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:
and here is a simple sample pbix file, please try it.
Regards,
Lin
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
Proud to be a Datanaut!
Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City
Check out the April 2024 Power BI update to learn about new features.
User | Count |
---|---|
110 | |
95 | |
76 | |
65 | |
51 |
User | Count |
---|---|
146 | |
109 | |
106 | |
88 | |
61 |