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
katyfailoo
Advocate I
Advocate I

% in a measure not adding up

Hi All,

 

I have two tables

 

Table A

Listed below is how it looks like

ReasonDateEmployee IDYearFlag
A1/1/20211234120211
B1/1/20191242120191

 

Table B

It is just a calendar table

 

Both tables have a relationship on date

 

Goal is to get the % if I am under or over # of employees. 

 

My formula is as follows:

Over and Under=

Var lastyears = calculate(sumx(tablea, table[employee flag]), filter(tablea, table[year] <MAX(tablea[year])))

Var totalsumthisyear = calculate(sumx(tablea, table[employee flag]), filter(tablea, table[year] ==MAX(tablea[year])))

Return

totalsumthisyear/(lastyears/3) ** Note I added divided by three because that's how many years I have of data that is not 2021

 

So far I got my % and what I want

 

However if I pull in the values below in a table

  • Column from Date Table B
  • Measure over and under

Problem 1) Only works with Month and not Year

Problem 2) I can't get the %'s shows to add up.

 

Date (From Calendar table b)Over and Under
Jan123%
Feb45%
March (list goes on)10%
TOTAL12% *Random # that does not add up.

 

Why doesn't my measure add up in a matrix? How do I get my measure to add up in a matrix? Should I write another calculation?

 

Also, how do I get the count of n years? so I don't have to manually add in 3? Eventually 2022 will come around and formula needs to be adjusted to 4 

 

Appreciate the help!

3 REPLIES 3
v-henryk-mstf
Community Support
Community Support

Hi @katyfailoo ,

 

For the problem you describe, you may wish to refer to the following blog, I hope it will help you.

Dealing with Measure Totals - Microsoft Power BI Community


If the problem is still not resolved, please provide detailed error information and let me know immediately. Looking forward to your reply.


Best Regards,
Henry


If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

AlexisOlson
Super User
Super User

If you were 25% over every single month in a year, do you expect the total to be the average amount you were over for the year (25%), or do you actually want to show 12 * 25% = 300%? How do you interpret that 300%?

Hi Alexis, 

 

Thank you for your response! For the year it would be the average.

 

So far I have the percentages for each month (using my calculation); however they don't add up. I want to add those % for each month, so that I can use the total and divide it by the # of months I have.

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.