Forum Discussion
Retrieve values from rows where monthly max occurs.
I have a situation where my boss wants to know the date, hour and values of our generation data for each month. This is breaking my brain. We have 5 years of hourly data. Here what I envision the results looking like.
The problem I have is that instead of showing the values from the individual row (hour) the results just give the peak of each resource for the entire month. I need the values from the hour that the Peak Generation occurs each month. Not the peak of each resource for the entire month.
heberpower can you throw sample data in a pbix file and expected output, will get back to you with the solution.
- Anonymous5 years ago
Hi heberpower
I think you want to show the max Hour per month.
You can try to build a matrix visual and use a measure filter in this visual.
My Sample:
Measure:
Measure = VAR _MaxHourPerMonth = MAXX(FILTER(ALL('Table'),'Table'[Year]=MAX('Table'[Year])&&'Table'[Month]=MAX('Table'[Month])),'Table'[Hour]) VAR _MaxDate = CALCULATE(MAX('Table'[Date]),FILTER(ALL('Table'),'Table'[Year]=MAX('Table'[Year])&&'Table'[Month]=MAX('Table'[Month])&&'Table'[Hour]=_MaxHourPerMonth)) RETURN IF(MAX('Table'[Date])=_MaxDate,1,0)Result is as below.
Set the measure to show items when the value is 1.
Best Regards,
Rico Zhou
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
- Anonymous5 years ago
Hi heberpower
Could you tell me if your problem has been solved? If it is, kindly Accept it as the solution. More people will benefit from it. Or you are still confused about it, please provide me with more details about your table and your problem or share me with your pbix file from your Onedrive for Business.
Best Regards,
Rico Zhou
8 Replies
- parry2k
Super User
heberpower can you throw sample data in a pbix file and expected output, will get back to you with the solution.
- heberpowerFrequent Visitor
This is a small dataset
And here are the desired results. I need to retrieve 1 row for each month where the "Peak" is the MAX during that month. Like this:
Thanks!
- Ashish_Mathur
Super User
Hi,
Share the link from where i can download your MS Excel workbook.
- AnonymousNot applicable
Hi heberpower
I think you want to show the max Hour per month.
You can try to build a matrix visual and use a measure filter in this visual.
My Sample:
Measure:
Measure = VAR _MaxHourPerMonth = MAXX(FILTER(ALL('Table'),'Table'[Year]=MAX('Table'[Year])&&'Table'[Month]=MAX('Table'[Month])),'Table'[Hour]) VAR _MaxDate = CALCULATE(MAX('Table'[Date]),FILTER(ALL('Table'),'Table'[Year]=MAX('Table'[Year])&&'Table'[Month]=MAX('Table'[Month])&&'Table'[Hour]=_MaxHourPerMonth)) RETURN IF(MAX('Table'[Date])=_MaxDate,1,0)Result is as below.
Set the measure to show items when the value is 1.
Best Regards,
Rico Zhou
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
- heberpowerFrequent Visitor
Thanks for the idea! I think you are on the right track but when I use that measure I end with with the results from the last day of every month. Do you have any idea what I have done wrong?
- heberpowerFrequent Visitor
I see what is happening here, you are getting the max hour per month, actually I need the row with the max Peak Generation in each month. I do not know how to do this. I really do appreciate your help!
- Ashish_Mathur
Super User
Hi,
On a small dataset, please show the expected result.
- AnonymousNot applicable
Hi heberpower
Could you tell me if your problem has been solved? If it is, kindly Accept it as the solution. More people will benefit from it. Or you are still confused about it, please provide me with more details about your table and your problem or share me with your pbix file from your Onedrive for Business.
Best Regards,
Rico Zhou