Forum Discussion
MAKE SUM() IGNORE ROW CONTEXT
- 7 years ago
Anonymous - Well it is doing a SUMMARIZE so that can take some time, See if this speeds it up:
Measure 3 = VAR __date = MAX([Date]) VAR __table = SUMMARIZE(FILTER(ALL('Table4'),[Date]=__date),[Emp_no],[Date],"__hours",SUM([S_Total])/60/60) RETURN MAXX(__table,[__hours])As for the 2nd one, that should be equivalent. I created a second measure just like it and got the same results so not sure what is going on there. See attached, Table4, Page 3.
Greg_Deckler thanks.
I want to display both of the rows but show the measure only on the first row.
any way to do so?
Anonymous - Can you share example/sample data? Please see this post regarding How to Get Your Question Answered Quickly: https://community.powerbi.com/t5/Community-Blog/How-to-Get-Your-Question-Answered-Quickly/ba-p/38490
- Anonymous7 years agoNot applicable
Greg_Deckler , I appreciate your effort :smileyhappy:
Here you have a sample data with the date that appears twice marked in green:
Emp_no Date S_Total BeginWork 66605486 01/09/2018 00:00 0 01/09/2018 00:00 66605486 02/09/2018 00:00 36780 02/09/2018 11:59 66605486 03/09/2018 00:00 23940 03/09/2018 07:37 66605486 04/09/2018 00:00 41880 04/09/2018 07:28 66605486 05/09/2018 00:00 43200 05/09/2018 07:22 66605486 06/09/2018 00:00 23640 06/09/2018 07:40 66605486 07/09/2018 00:00 0 07/09/2018 00:00 66605486 08/09/2018 00:00 0 08/09/2018 00:00 66605486 09/09/2018 00:00 16980 09/09/2018 07:18 66605486 10/09/2018 00:00 0 10/09/2018 00:00 66605486 11/09/2018 00:00 0 11/09/2018 00:00 66605486 12/09/2018 00:00 33660 12/09/2018 07:27 66605486 13/09/2018 00:00 24420 13/09/2018 07:28 66605486 14/09/2018 00:00 0 14/09/2018 00:00 66605486 15/09/2018 00:00 0 15/09/2018 00:00 66605486 16/09/2018 00:00 37740 16/09/2018 07:32 66605486 17/09/2018 00:00 0 17/09/2018 00:00 66605486 18/09/2018 00:00 0 18/09/2018 00:00 66605486 19/09/2018 00:00 0 19/09/2018 00:00 66605486 20/09/2018 00:00 13020 20/09/2018 07:27 66605486 20/09/2018 00:00 36000 20/09/2018 20:00 66605486 21/09/2018 00:00 0 21/09/2018 00:00 66605486 22/09/2018 00:00 0 22/09/2018 00:00 66605486 23/09/2018 00:00 0 23/09/2018 00:00 66605486 24/09/2018 00:00 38940 24/09/2018 19:41 66605486 25/09/2018 00:00 38760 25/09/2018 19:44 66605486 26/09/2018 00:00 39120 26/09/2018 19:38 66605486 27/09/2018 00:00 33780 27/09/2018 19:07 66605486 28/09/2018 00:00 0 28/09/2018 00:00 66605486 29/09/2018 00:00 0 29/09/2018 00:00 66605486 30/09/2018 00:00 0 30/09/2018 00:00 and here you can see the expected result with the date that appears twice marked in green:
Emp_no Date HoursTotal 66605486 01/09/2018 00:00 66605486 02/09/2018 00:00 10.22 66605486 03/09/2018 00:00 6.65 66605486 04/09/2018 00:00 11.63 66605486 05/09/2018 00:00 12.00 66605486 06/09/2018 00:00 6.57 66605486 07/09/2018 00:00 66605486 08/09/2018 00:00 66605486 09/09/2018 00:00 4.72 66605486 10/09/2018 00:00 66605486 11/09/2018 00:00 66605486 12/09/2018 00:00 9.35 66605486 13/09/2018 00:00 6.78 66605486 14/09/2018 00:00 66605486 15/09/2018 00:00 66605486 16/09/2018 00:00 10.48 66605486 17/09/2018 00:00 66605486 18/09/2018 00:00 66605486 19/09/2018 00:00 66605486 20/09/2018 00:00 13.62 66605486 20/09/2018 00:00 66605486 21/09/2018 00:00 66605486 22/09/2018 00:00 66605486 23/09/2018 00:00 66605486 24/09/2018 00:00 10.82 66605486 25/09/2018 00:00 10.77 66605486 26/09/2018 00:00 10.87 66605486 27/09/2018 00:00 9.38 66605486 28/09/2018 00:00 66605486 29/09/2018 00:00 66605486 30/09/2018 00:00 thanks in advance !
- Greg_Deckler7 years ago
Community Champion
Anonymous - I did it this way:
Measure 3 = VAR __table = SUMMARIZE(ALL('Table4'),[Emp_no],[Date],"__hours",SUM([S_Total])/60/60) VAR __date = MAX([Date]) RETURN MAXX(FILTER(__table,[Date]=__date),[__hours])See attached, Table4, Page 3
- Anonymous7 years agoNot applicable
Greg_Deckler Thanks!i have 2 more questions please :smileyhappy:
1. is it a complexed measure? it's taking some time to calculate
2. I had to write it exactly like you did. can you please explain to me whats the difference between the 2 syntax's :
VAR Table1 = SUMMARIZE(ALL('activity'),[Emp_no],[Date],"DayHours",SUM([S_Total])/3600) VAR _Date = MAX([Date]) RETURN MAXX(FILTER(Table1,[Date]=_Date),[DayHours])this code produces the following result just like you said in the following picture:
while the following code produces a different result:
VAR Table1 = SUMMARIZE(ALL('activity'),activity[Emp_no],activity[Date],"DayHours",SUM(activity[S_Total])/3600) VAR _Date = MAX(activity[Date]) RETURN MAXX(FILTER(Table1,[Date]=_Date),[DayHours])What is the differnce?