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
Anonymous
Not applicable

I need correct total of sum divided by max

Hi, guys.

 

In my model I have a table with data I need summarized by date (basicaly, sum of all data on a given day) and I need that measure divided by max value from the rows (from the same table) for the same day, and all this for each worker who worked on that day.

 

Basicaly, it looks like this Goal = Divide(SUMX(table 1, column 1),MAXX(table 1, column 2)

 

Table can be something like this: 

 

Date      (1)      (2)       (3)

01.10.   100     50       Name 1

01.10.   200     50       Name 2

01.10.   300     100     Name 1

01.10.    50      30       Name 2

02.10.   100     120     Name 1

02.10.   400     100     Name 2

03.10.   500     100     Name 1

 

So, I need for 01.10. Sum(1)/Max(2) = 400/100+250/50=150 and that to apply for each day.

 

Also, I need a correct total, because every time I make a measure, it sums me only per days (the measure don't diferentiate the workers).

1 ACCEPTED SOLUTION
v-yanjiang-msft
Community Support
Community Support

Hi @Anonymous ,

According to your description, heres my solution.

1.Create a measure for each name in one day.

vkalyjmsft_0-1635384246671.png

 

2.Create the final goal.

vkalyjmsft_1-1635384246675.png

 

Best Regards,
Community Support Team _ kalyj

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

View solution in original post

8 REPLIES 8
v-yanjiang-msft
Community Support
Community Support

Hi @Anonymous ,

According to your description, heres my solution.

1.Create a measure for each name in one day.

vkalyjmsft_0-1635384246671.png

 

2.Create the final goal.

vkalyjmsft_1-1635384246675.png

 

Best Regards,
Community Support Team _ kalyj

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

I have a very similar table (Store, Service, revenue, date) and desired result.   I've used your example, but all i end up with is "1"s

 

percentile 2 = var _sum=Calculate(sum(PharmacyServices[ServicesRevenue]),FILTER(ALLSELECTED(PharmacyServices),[ServiceDescription]=MAX(PharmacyServices[ServiceDescription])&&[Date]=MAX(PharmacyServices[Date]))) Var _Max=Calculate(Max(PharmacyServices[ServicesRevenue]),Filter(ALLselected(PharmacyServices),[ServiceDescription]=MAX(PharmacyServices[ServiceDescription])&&[Date]=MAX(PharmacyServices[Date]))) Return DIVIDE (_sum,_max)

Table with slicer applied for store 522
weport.jpg
Here's the raw data for the first Service.   The result of the calculation IMO should be 14/70 = .2 or 20%
rd.jpg
Any help is greatly appreciated! 
Anonymous
Not applicable

Thank you! 

 

That did the trick.

speedramps
Super User
Super User

Hi sabreGEA

 

It might just be me, but I dont undestand your problem.  Please can you try explain it more clearly. Thanks

 

In the meantime these measure may help .you understand how to get a max value for name or date.


Remember we dont get paid, we are BI community voluntrees so please click the thumbs-up for me taking the trouble to help you and then accept the solution if it works.  Thank you !

 

Max value =
MAX('Table'[Value1])

 

 

Max value for name =
CALCULATE(
MAX('Table'[Value1]),
ALLEXCEPT('Table','Table'[Name])
)

 

 

Max value for date =
CALCULATE(
MAX('Table'[Value1]),
ALLEXCEPT('Table','Table'[Date])
)

Anonymous
Not applicable

Hi, speedramps .

 

Thank you for your help. 

 

I'm attaching the screenshot with my issue. 

 

Screenshot_1.jpg

 

So, I'm having dates, workers names, column 1 (sum of working hours per date), column 2 (max of possible working hours per day) and column where I divided columns one and two. 

 

I need the correct total for max values (highlighted red).

Hi again
 
This measure gets the max value for all 
 
Max value for all  =
CALCULATE(
MAX('Table'[Value1]),
ALL()
)
Anonymous
Not applicable

That measure just included workers I filtered earlier and total of max column is still wrong.

 

var summax = MAXX(table 1,value 1)

RETURN

IF(HASONEVALUE(table 1, date column),

summax,

SUMX(VALUES(table 1, date column),summax))

 

This is the measure I tried with no avail.

I'm sorry, I dont understand.

See the forum for tips on how to get your question answered.

Good luck.

 

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.