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.
I'm calculating occupancy for a particular fiscal year, which seems to be working fine (except the total, I'd like that to be the average percentage of the total - right now it's summing).
The issue I run into is when I select multiple fiscal years. It's adding the percentages. How can I write this formula to give me a percentage over one or more fiscal years. I am using a date table.
Solved! Go to Solution.
Hi, @pbrainard
Try to add two additional measures, one to calculate the percentage of each year, and the other to modify the sum of the total to the average.
Sample data:
_divide:
_divide =
var _a=SUM('Table'[Sale])
var _b=CALCULATE(SUM('Table'[Sale]),ALL('Table'))
var _divide=DIVIDE(_a,_b)
return _divide
So to create 2 measures like this:
_Year% = CALCULATE([_divide],ALLEXCEPT('Table','Table'[Year]))
The result we want would be this:
_average% =
IF ( HASONEVALUE ( 'Table'[Year] ), [_divide], AVERAGEX ( 'Table', [_Year%] ) )
result:
Please refer to the attachment below for details
Hope this helps.
Best Regards,
Community Support Team _ Zeon Zheng
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Hi, @pbrainard
Try to add two additional measures, one to calculate the percentage of each year, and the other to modify the sum of the total to the average.
Sample data:
_divide:
_divide =
var _a=SUM('Table'[Sale])
var _b=CALCULATE(SUM('Table'[Sale]),ALL('Table'))
var _divide=DIVIDE(_a,_b)
return _divide
So to create 2 measures like this:
_Year% = CALCULATE([_divide],ALLEXCEPT('Table','Table'[Year]))
The result we want would be this:
_average% =
IF ( HASONEVALUE ( 'Table'[Year] ), [_divide], AVERAGEX ( 'Table', [_Year%] ) )
result:
Please refer to the attachment below for details
Hope this helps.
Best Regards,
Community Support Team _ Zeon Zheng
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
@pbrainard , this should work fine as long as these are sum or count measure
example
divide(sum(Table[A]), sum(Table[B]))
Can you share sample data and sample output in table format? Or a sample pbix after removing sensitive data.
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 |
---|---|
104 | |
101 | |
79 | |
72 | |
64 |
User | Count |
---|---|
142 | |
108 | |
101 | |
81 | |
74 |