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 all, this seems so easy in my head but I haven't been able to get it for the last few hours....
I have a Matrix visualization that provides Cost by Hour using measures.
Category | Total Cost | Hours | Cost per Hour A | 1000 | 10 | 100 B | 2000 | 100 | 20 C | 100 | 4 | 25 D | -500 | 100 | -5
Total | 2600 | 214 | 12.1495
For my purposes I would also like to create a % of Grand Total of Cost per hour to add to a treechart visualization. However, if i simply add [Cost per Hour] to the treechart again and use the "quick clac" functionality on the field it would return 823.7% for the first record in the above table as (100/12.1495) = 8.2307. I would like this % of GT of Cost per Hour to use the total sum of the Cost per Hour column. Desired Result:
Category | Total Cost | Hours | Cost per Hour | % of Cost per Hour A | 1000 | 10 | 100 | 71.4% B | 2000 | 100 | 20 | 14.3% C | 100 | 4 | 25 | 17.9% D | -500 | 100 | -5 | -3.8% Total | 2600 | 214 | 12.1495 | 100%
A few things to note.
[Total Cost] is a Measure which adds together 5 other Measures from 5 different tables
[Hours] is a Measure which adds together a column from a table and divides by the distinct count of records in that table
[Cost per Hour] is a Measure = [Total Cost] / [Hours]
All of these Measures are filtered by multiple filtered visualizations and page level filters from many different tables and have a relationships created using an index number between the tables.
I sort of feel like this is similar to people wanting to add percentages to pie charts... I'm just trying to ascribe a real number to express the proportion displayed in the TreeChart visualization. I really hope that this is easier than it seems.
Hi @MarkDGaal,
In your scenario, does the total row is auto generaled? If that is the case, then why can you get 12.495 for Cost per Hour column. Generally, the total show 140 for Cost per Hour column.
And if you create calculated columns instead of measures, you can get your expected result by using the DAX below.
Percentage = Percentage[CostPerHour]/SUM(Percentage[CostPerHour])
Regards,
Charlie Liao
@v-caliao-msft hi there, the total row is the default "totals" option for the standard Table Visualization. I'm not sure how I can get the totals row to evaluate to 12.1495 for [Cost per hour] but I assure you it does....
If you'd like to explore deeper here are the the measures that lead to the totals row evaluating to 12.1495 for [CostperHour].
Hours = IF(ISFILTERED('Tabe1'[FY]),SUM('Table1'[Hours])/DISTINCTCOUNT('Table1'[Column Header Name]),0)
Total Cost = [cost1]+[cost2]
CostPerHour= IFERROR(([cost1]+[cost2])/[Hours],0)
cost1 = IF(ISFILTERED(table2[AGB Cost Element]) || ISFILTERED(table2[Cost Category])|| ISFILTERED(table2[Flying or Non-Flying])|| ISFILTERED(table2[Org Level]) || ISFILTERED(table2[Personnel Category]), SUM(table2[Value]),0)
cost2 = IF(ISFILTERED('table3'[AGB Cost Element]) || ISFILTERED('table3'[Cost Category]), SUM(table3[Fuel Cost]),0)
If I recall correctly calculated columns have trouble using measures so I will recreate all of my measures as calculated columns and let you know if that solves my problem tomorrow.
User | Count |
---|---|
120 | |
77 | |
58 | |
52 | |
46 |
User | Count |
---|---|
171 | |
117 | |
63 | |
57 | |
51 |