Forum Discussion
MiroslawW
7 years agoFrequent Visitor
Summing only max value from a day.
Hi,
I have got problem to make a pivot table that summerize maximum hours from a day schedule (I have copied only piece of it):
| START DATE | END DATE | NAME | TRAINING | TYPE | HOURS | INSTRUCTOR | RESULT |
| 21/01/2019 | 23/01/2019 | NAME1 | 22.00 | MW | PASS | ||
| 21/01/2019 | 21/01/2019 | NAME2 | 6.00 | NB | PASS | ||
| 21/01/2019 | 22/01/2019 | NAME3 | 6.00 | NB | PASS | ||
| 23/01/2019 | 23/01/2019 | NAME4 | 4.50 | NB | PASS |
I want to make a pivot table that summarize hours by instructor but i dont know how to make a measure in a DAX.
My pivot table looks like this:
| Sum of HOURS | Column Labels | ||
| Row Labels | MW | NB | Grand Total |
| 2019 | 157 | 233.5 | 391 |
| Qtr1 | 157 | 233.5 | 391 |
| Grand Total | 157 | 233.5 | 391 |
I want to sum only max value from 21/01/2019 of instructor NB. Is there any measure that I could use?
Thank You,
You should be able to do something like:
Measure 6 = VAR __date = MAX([START DATE]) VAR __instructor = MAX([INSTRUCTOR]) VAR __table = SUMMARIZE('Table8',[START DATE],[INSTRUCTOR],"__hours",MAX([HOURS])) RETURN MAXX(__table,[START DATE]=__date && [INSTRUCTOR]=__instructor)
1 Reply
- Greg_Deckler
Community Champion
You should be able to do something like:
Measure 6 = VAR __date = MAX([START DATE]) VAR __instructor = MAX([INSTRUCTOR]) VAR __table = SUMMARIZE('Table8',[START DATE],[INSTRUCTOR],"__hours",MAX([HOURS])) RETURN MAXX(__table,[START DATE]=__date && [INSTRUCTOR]=__instructor)