Like many others I see on forum and elsewhere, I am having issues with row and grand totals within a Matrix. I definitely need to learn much more about DAX but have searched here and elsewhere and still can’t get my head around it. I believe the Summarize function is needed but logic may have been incorrect.
Any DAX formulas to assist would be greatly appreciated.
I have Total Payroll Hours Paid broken out by Employee within Hospital Job. I want to multiply these Paid Hours by a monthly Burden Rate and calculate Allocated Costs.
You can see from below screenshot that the Individual rows are accurate but the Row and Grand Totals are not. I would like for the Burden Rate and the Allocated Totals to be accurate. However, I may delete the Burden Rate column if inaccurate.
Total Labor Hours Paid = [Total Reg Hrs Paid] + [Total OT Hours] + [Total DT Hours]
Burden Rate for Month = sumx(filter(‘Burden Table’,‘Burden Table’[Date]), ‘Burden Table’[Burden Rate]) NOT SURE THIS IS BEST WAY or IF NEEDED[
Second issue is I would want any Hospital that had no Paid Hours not to show in visual. Screenshot below shows that the Burden Rate shows on every line. I would prefer to do this within the DAX formula rather than a filter.
I have uploaded a simplied version of the pbix file.
I tried your formula but it still has some issues with the totals and some other lines. The first screen shot you sent was more accurate. This is what I get with the same fields as first screenshot and formula provided. I have highlighted in yellow and red the issues still.
Hi @RBDport, did the response provided by the contributors help you solve your query? If not, how far did you get and what kind of help you need further? If yes, kindly mark the thread as solved. Thanks!
Thanks for the help. I won’t be able to review your post and check it out till this afternoon hopefully (my month end work starts today). I will let you know then if it fixes the issue or if I have any questions. Thanks again.
I had a chance to review and changed one item on the Burden Rate for Month - from SUMX to AVERAGE and deleted the sum line. The Burden Rate should be an average of all the rates. My totals look like they are ok now. I also decided to keep the rate the same for everyone and for each month as well perhaps.
Questions for you in follow-up:
What is the significance of the
Also, can you help get rid of the extra lines that are blank as to Hospital - Hours. See below. I would prefer to do in DAX rather than a filter.
I appreciate your help. I understand the HASONEVALUE and context more with your help, and also how to correct the totals.
Not sure if I have understood your request, but I will try.
This is a very useful technique. But my apology, it shouldn’t have been written so poorly.
Better versions of the same calculation:
VALUES - creates virtual table from column "Jobs[Hospital Name] ADDCOLUMNS - allows to add additional column,
“@Burden” - name of column which includes the following calculation: SUM (‘Burden Table’[Buden Rate])
Virtual table was created with 2 columns:
Hospital Name
SUM of Burden rate
Function SUMX sums the Burden Rate from the column “@Burden”.
One of the best techniques!. I will send you some links form EnterpriseDNA courses in a few days.
To get rid of any rows you can refer to other column and check if there is a value, if not you can make the number “3.87” blank().
Like this: IF( ISBLANK( [Total Labor Hours Paid]), blank(), …)
Burden Rate for Month =
VAR Calc1 =
sumx(
filter(
‘Burden Table’,
‘Burden Table’[Date]),
‘Burden Table’[Burden Rate])
VAR Calc2 =
AVERAGE(‘Burden Table’[Burden Rate])
I appreciate all your help. This looks good and $ look okay, but I have one question. When I change the row layout of visual (currently works with this)
But, if I move say hospital to top of rows for visual (see below). The $ on Burden Rate and Allocation are now incorrect. I tried to change some DAX to fix but to no avail.
Will these measures only work with rows a certain way? Or does DAX have to be changed? Filters are not changed and remain the same.
Thanks for all your help with this. I’ve been trying for 3 weeks to get something to work. I definitely need to learn DAX more and row context, iterator process, etc. I learned COBOL, and RPG years ago (when using Punch Cards !!). A little easier today. Just need to learn the DAX language.