The ultimate Fabric, Power BI, SQL, and AI community-led learning event. Save €200 with code FABCOMM.
Get registeredEnhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends September 15. Request your voucher.
Hello,
I have a project where I have two factual tables and I have a metric which is the divide labor cost by average fte. The labor cost metric goes to one table (laborcost) and the average fte goes to another table (headcounts). The metric is fine on the line but the grand total is different from the sum of the lines in the table. I've tried sumx, summarize, putting everything together in a single factual table. Here in these fact tables I have no way of linking them. Have you experienced something similar?
Thank you
Solved! Go to Solution.
Hi @mariajoaomp,
For multiple level aggregations in measure, I'd like to suggest you consider to using summarize function to aggregate the first level and use iterator function(e.g. sumx, averagex) on above result to apply the second level aggregation:
All the secrets of SUMMARIZE - SQLBI
Measure Totals, The Final Word
Regards,
Xiaoxin Sheng
HI @mariajoaomp,
Can you please share a pbix or some dummy data that keep the raw data structure with expected results? It should help us clarify your scenario and test to coding formula.
How to Get Your Question Answered Quickly
In addition, you can also take a look at the greg's blog about handle with measure expression and multiple aggregations if it suitable for you scenarios:
Measure Totals, The Final Word
Regards,
Xiaoxin Sheng
Hello,
Can you please attach a sample dataset or screenshots of your sample data and how your visual looks?
Thank you
here's the problem. The sum of the total is not the sum of the rows. The average cost metric is Average Cost SUMX:= DIVIDE(
[LabourCost SUMX],CALCULATE(
[Average FTE SUMX],ALL(Account)),0)
and auxiliary metrics are LabourCost and AverageFTE
Labour Cost SUMX :=
CALCULATE (
SUMX ('UNION', 'UNION'[ValueLaborCost] ),
FILTER (
Account,Account[INDEX Level LabourCost]=5)
)
Average FTE SUMX :=
CALCULATE (
SUMX ('UNION', 'UNION'[ValueHeadCount] ),
FILTER (
Account,Account[INDEX Level FTE]=4)
)
The structure/fields of the table are the same. In this example, I've even put everything in a single table that I've called union, but the accounts of the laborcosts and the accounts of averagefte are different and so I can't link them.
Can anyone help me?
Hi @mariajoaomp,
For multiple level aggregations in measure, I'd like to suggest you consider to using summarize function to aggregate the first level and use iterator function(e.g. sumx, averagex) on above result to apply the second level aggregation:
All the secrets of SUMMARIZE - SQLBI
Measure Totals, The Final Word
Regards,
Xiaoxin Sheng
User | Count |
---|---|
14 | |
11 | |
6 | |
6 | |
5 |
User | Count |
---|---|
28 | |
18 | |
12 | |
7 | |
5 |