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
CMccown
Helper I
Helper I

Need to filter a measure to reflect first date of value occurrence in a table

I have a table visualization reflecting raw data filtered by month and year with measures that determine the peak value, and the hour and date on which they occurred. Unfortunately during the month of February 2019, and December 2020 the peak value occurs twice in the same month and I want to reflect the data from Hour Ending 1 - Hour Ending 24 in the table from the correct peak date. I need assistance with either filtering my measure to account for this when finding the peak value, or by finding a way to break the tie for the TOPN filter I am using (see screen shot). 

 

My measure to calculate the peak load is: 

Monthly Peak Load = CALCULATE(MAX('System_Load'[Hr Sys Load]),FILTER('System_Load','System_Load'[Month]))
 
My measure to calculate peak hour is: 
Monthly Peak Hour = Var __SelectedMax =
 CALCULATE(
   CALCULATE(MAX('System_Load'[Hr Sys Load]),FILTER('System_Load','System_Load'[Month])))

RETURN
 
CALCULATE(MIN(System_Load[Hour Ending]),
    FILTER(System_Load, FIRSTDATE(System_Load[Date])),
        System_Load[Hr Sys Load] = __SelectedMax, System_Load[Month])
 
My measure to calculate peak date is:
 
Monthly Peak Date = Var __SelectedMax =

   CALCULATE(MAX('System_Load'[Hr Sys Load]),FILTER('System_Load','System_Load'[Month]))

RETURN

CALCULATE(
    FIRSTDATE(System_Load[Date]),
        System_Load[Hr Sys Load] = __SelectedMax, System_Load[Month])
 
As the screenshot shows, the peak value appears once on the correct peak hour Hour Ending 8, however, for the rest of the hours of the day, values for the correct peak date and the duplicate date (which happens to be the following day at the exact same hour in the example) are returned. 
 
CMccown_0-1678235304237.png

 Assistance is greatly appreciated!

 

 
0 REPLIES 0

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.