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

Return the time at which a max-value occurred with slicer selection

Hello,

 

I have a fact table that has kW usage recorded every 15 minutes. What I am trying to do is to output the corresponding time that the max value has occurred based on the slicer selection from a list of dates that is related to another table. There can be multiple times in the day that the kW usage is the same, which I would like to have both time occurrences displayed. The Time of Use column is the Season Slicer, which description below. 

  Season

  • Summer Mid Peak - (June 1 - Sept 30, 10am - 1pm & 7pm - 10pm)
  • Summer Off Peak - (June 1 - Sept 30, 10pm - 10am)
  • Summer On Peak - (June 1 - Sept 30, 1pm - 7pm)
  • Winter Off Peak - (October 1 - May 31)

KW_Table

ptanlim_0-1652900936691.png

 

ptanlim_1-1652901263930.png

Based on the slicer selection of Summer On Peak, I would like to have a column in the table with the first row for 6/8/2021 to output 1:15 PM (Green Box). Should the user select only Summer Mid Peak as the slicer, the output will show 12:30 PM (Red Box). Should they select both Summer Mid & Off Peak as a slicer, the output will show 1:15pm since that is the max usage during that time frame. 

 

Measure

kW_Max =CALCULATEMAX(KW[Usage]), RELATEDTABLE(ShowCalendar))

 

Relationship Table

 

ptanlim_2-1652902413964.png

 

 

Please advise and many thanks. 

 

 

 

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

Hi  @Anonymous ,

Here are the steps you can follow:

1. Create measure.

Flag =
var _select=SELECTEDVALUE('Table'[Time of Users])
return
IF(
    MAX('Table'[Usage])=
MAXX(FILTER(ALL('Table'),'Table'[Time of Users]=_select),[Usage]),1,0)

2. Place [Flag]in Filters, set is=1, apply filter.

vyangliumsft_0-1653284661463.png

3. Result:

vyangliumsft_1-1653284661464.png

If you need pbix, please click here.

 

Best Regards,

Liu Yang

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

1 REPLY 1
v-yangliu-msft
Community Support
Community Support

Hi  @Anonymous ,

Here are the steps you can follow:

1. Create measure.

Flag =
var _select=SELECTEDVALUE('Table'[Time of Users])
return
IF(
    MAX('Table'[Usage])=
MAXX(FILTER(ALL('Table'),'Table'[Time of Users]=_select),[Usage]),1,0)

2. Place [Flag]in Filters, set is=1, apply filter.

vyangliumsft_0-1653284661463.png

3. Result:

vyangliumsft_1-1653284661464.png

If you need pbix, please click here.

 

Best Regards,

Liu Yang

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

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.