Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Find everything you need to get certified on Fabric—skills challenges, live sessions, exam prep, role guidance, and more. Get started

Reply
heberpower
Frequent Visitor

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.

Gen_Master_Data.jpg

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.      

3 ACCEPTED SOLUTIONS
parry2k
Super User
Super User

@heberpower can you throw sample data in a pbix file and expected output, will get back to you with the solution.



Subscribe to the @PowerBIHowTo YT channel for an upcoming video on List and Record functions in Power Query!!

Learn Power BI and Fabric - subscribe to our YT channel - Click here: @PowerBIHowTo

If my solution proved useful, I'd be delighted to receive Kudos. When you put effort into asking a question, it's equally thoughtful to acknowledge and give Kudos to the individual who helped you solve the problem. It's a small gesture that shows appreciation and encouragement! ❤


Did I answer your question? Mark my post as a solution. Proud to be a Super User! Appreciate your Kudos 🙂
Feel free to email me with any of your BI needs.

View solution in original post

v-rzhou-msft
Community Support
Community Support

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:

1.png

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.

2.png

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. 

View solution in original post

v-rzhou-msft
Community Support
Community Support

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

View solution in original post

8 REPLIES 8
v-rzhou-msft
Community Support
Community Support

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

v-rzhou-msft
Community Support
Community Support

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:

1.png

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.

2.png

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. 

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!

Hi,

On a small dataset, please show the expected result.


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/

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?

 

power_bi_matrix.jpg

parry2k
Super User
Super User

@heberpower can you throw sample data in a pbix file and expected output, will get back to you with the solution.



Subscribe to the @PowerBIHowTo YT channel for an upcoming video on List and Record functions in Power Query!!

Learn Power BI and Fabric - subscribe to our YT channel - Click here: @PowerBIHowTo

If my solution proved useful, I'd be delighted to receive Kudos. When you put effort into asking a question, it's equally thoughtful to acknowledge and give Kudos to the individual who helped you solve the problem. It's a small gesture that shows appreciation and encouragement! ❤


Did I answer your question? Mark my post as a solution. Proud to be a Super User! Appreciate your Kudos 🙂
Feel free to email me with any of your BI needs.

This is a small datasetdata_set.jpg

 

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:

desired_results.jpg

 

Thanks!

Hi,

Share the link from where i can download your MS Excel workbook.


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/

Helpful resources

Announcements
July 2024 Power BI Update

Power BI Monthly Update - July 2024

Check out the July 2024 Power BI update to learn about new features.

July Newsletter

Fabric Community Update - July 2024

Find out what's new and trending in the Fabric Community.