March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount! Early bird discount ends December 31.
Register NowBe one of the first to start using Fabric Databases. View on-demand sessions with database experts and the Microsoft product team to learn just how easy it is to get started. Watch now
Hi everyone,
I am trying to calculate the utilization of a team of people per period. But I am stuck with an error.
I have two tables. One fact table that holds the time_spent value and a dimensions table that holds the total_capacity of the team member value.
The calculation is fairly straigth forward:
(time_spent / total_capacity) * 100%
So my dax measure is as follows:
Utilization Percentage = CALCULATE(
DIVIDE(
SUM(tbl_1[time_spent]),
SUM(tbl_2[total_capacity])),
ALLSELECTED('tbl_1')
*100)
However this is giving me an "The expression refers to multiple columns. Multiple columns cannot be converted to a scalar value."
If I remove the "ALLSELECTED" clause the code works but the measure does not take some filters into consideration. Giving me incorrect information.
What I essentially want is a measure that calculates the utilization % but still respects all the applied filters on the visual.
Solved! Go to Solution.
@BruceSV , I think you've put *100 in the wrong place..
Utilization Percentage =
CALCULATE (
DIVIDE ( SUM ( tbl_1[time_spent] ), SUM ( tbl_2[total_capacity] ) ) * 100,
ALLSELECTED ( 'tbl_1' )
)
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly. Appreciate your Kudos.
Check out my latest demo report in the data story gallery.
Stand with Ukraine!
Here are official ways you can support Ukraine financially (accounts with multiple currencies):
1) Support the Armed Forces of Ukraine: https://bank.gov.ua/ua/about/support-the-armed-forces
2) Come Back Alive foundation: https://www.comebackalive.in.ua/
Thank you!
@BruceSV , I think you've put *100 in the wrong place..
Utilization Percentage =
CALCULATE (
DIVIDE ( SUM ( tbl_1[time_spent] ), SUM ( tbl_2[total_capacity] ) ) * 100,
ALLSELECTED ( 'tbl_1' )
)
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly. Appreciate your Kudos.
Check out my latest demo report in the data story gallery.
Stand with Ukraine!
Here are official ways you can support Ukraine financially (accounts with multiple currencies):
1) Support the Armed Forces of Ukraine: https://bank.gov.ua/ua/about/support-the-armed-forces
2) Come Back Alive foundation: https://www.comebackalive.in.ua/
Thank you!
Although the syntax is approved the results are not what I expected. The measure now doesnt apply the legend anymore.
Edit - It actually did work and surfaces a different problem, need to update my data model. Thanks @ERD
Hi @BruceSV ALLSELECTED is most compex function in DAX.
Usually you should have some aggregation in case of this error.
My question to you why in your ALLSELECTED you put table_1 as in CALCULCATE there are also table_2 and why it is *100) at end? Did you try pure ALLSELECTED ()?
Proud to be a Super User!
March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!
Your insights matter. That’s why we created a quick survey to learn about your experience finding answers to technical questions.
Arun Ulag shares exciting details about the Microsoft Fabric Conference 2025, which will be held in Las Vegas, NV.
User | Count |
---|---|
23 | |
16 | |
12 | |
9 | |
7 |
User | Count |
---|---|
38 | |
32 | |
28 | |
12 | |
11 |