Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

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.

Reply
czaldumbide
Helper I
Helper I

Trouble getting grand total of DAX measure in matrix visual

Hey Guys,

 

I am having trouble creating a measure that correctly calculates the total when added to a pivot table.

I am attaching a sample PBIX file for you to use. 

https://drive.google.com/drive/folders/1ofIgAsGLc2VU7qLoFkdaz2vAqbjhsdH-?usp=sharing 

 

The goal of this report is to calculate how much income each customer generates. Currently, I have two sources of income per customer, and I want to add a 3rd one by looking at a different table. To do this I am using 2 tables.

 

The first one, “Monthly Interest Accruals”, is a table that has a single monthly record per customer. The following table depicts the format and columns for your reference.

image 4 accruals.png

Using this table, I simply drag Date. [Month] to my columns, Customer Name to my rows, and Interest, and Fund Earnings as my 2 values.

image 1.1.png

This gives me the following matrix visualization.

Image 5 before table.png

To this matrix, I want to add a 3rd value of income called “Below Min Average Fee”. This refers to a $100 dollar charge that is made to an account when the monthly average balance is below the requirement. To calculate this, I will use the second table, “General Ledger History”, which contains the past year records for all account’s balances. Below are a few rows of the table to give you a reference of how the table looks like.

Image 3 - GL.png

Using this table, I calculate the average of an account per month and see if it was below the requirement amount or not and flag that account. To do this I first create a calculated column with the minimum balance requirement. This measure basically says that the minimum average is $10,000 from January to July, and $50,000 from August to December.

 

Min Bal = IF(‘General Ledger History’[Date].[MonthNo] < 8, 10000, 50000)

 

Then, I create a measure to classify those accounts that will be charged the fee as 1 and those that do not as 0. The measure is as follows:

 

IsMinBal =

 IF(COUNTROWS(VALUES( 'General Ledger History'[Min Bal] ))=1,

        IF(VALUES( 'General Ledger History'[Min Bal] ) >  AVERAGE('General Ledger History'[Balance]),

         100,

         0 ),

   BLANK()

)

 

To test that the measure works, I created the following visualization:

table 3.png

As you can see those accounts with average below Min Bal for a month appear as 1 and the rest as 0.

 

Now my question to you, is how can I use this measure that flags the accounts, to show a charge on each respective account and month on the first matrix I created? Basically, I would like to get the following only that in the column of Below Min Balance Fee I would have 100 on each account that was flagged and the summation of all the charges as the total. (NOTE*= if there are more than one account per client that was flagged then the charge for that client on that month would be $100  x  # of accounts flagged).

Annotation 2019-12-27 144653.png

 

Any tips on how to solve this would be of great help! Thank you

1 ACCEPTED SOLUTION
Ashish_Mathur
Super User
Super User

Hi,

You may download my PBI file from here.

Hope this helps.

 

Untitled.png


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/

View solution in original post

5 REPLIES 5
v-diye-msft
Community Support
Community Support

Hi @czaldumbide 

 

If you've fixed the issue on your own please kindly share your solution. if the above posts help, please kindly mark it as a solution to help others find it more quickly.thanks!

 

Community Support Team _ Dina Ye
If this post helps, then please consider Accept it as the solution to help the other members find it more
quickly.
Ashish_Mathur
Super User
Super User

Hi,

You may download my PBI file from here.

Hope this helps.

 

Untitled.png


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/

Thank you for your solution. This definitely brings me a step closer to what I needed. When the minimum balance changes to 50,000 the penalty is not working properly so I might need to look further into it. 

Hi,

I am not sure whom you are replying to but did you try my solution?


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/
rajulshah
Super User
Super User

Hello @czaldumbide,

 

Maybe this link can help you achieve what you want.

 

Please let me know if it didn't.

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.